From 158048812f4e0aeb132408f4d7cda57ba008b0d5 Mon Sep 17 00:00:00 2001 From: Dugongue <49054532+Dugongue@users.noreply.github.com> Date: Thu, 22 Oct 2026 11:41:22 -0700 Subject: [PATCH] Construct reversible native ports for the repaired complex prefix --- .../.gitattributes | 1 + .../complex-prefix-native-ports/CHECKS.json | 79 ++++++ .../FULL-INPUT-PORT.md | 86 ++++++ research/complex-prefix-native-ports/LICENSE | 201 ++++++++++++++ .../complex-prefix-native-ports/MANIFEST.json | 24 ++ .../complex-prefix-native-ports/NOTICE.md | 9 + .../PREDECESSOR-NOTICE.md | 7 + .../complex-prefix-native-ports/README.md | 50 ++++ .../SECTOR-COMPLETION.md | 93 +++++++ .../SOURCE-PINS.json | 22 ++ .../complex-prefix-native-ports/SOURCES.json | 18 ++ .../complex-prefix-native-ports/TASK.json | 78 ++++++ .../complex-prefix-native-ports/VERIFY.json | 54 ++++ .../WORD-REVIEW.md | 45 +++ .../finite_geometry.py | 64 +++++ .../pr4688/README.md | 257 ++++++++++++++++++ .../pr4710/README.md | 152 +++++++++++ .../pr4710/verify_residual.py | 233 ++++++++++++++++ .../complex-prefix-native-ports/verify.py | 31 +++ .../verify_full_input_port.py | 57 ++++ .../verify_native_interface.py | 65 +++++ .../verify_sector_completion.py | 42 +++ .../verify_word_review.py | 69 +++++ 23 files changed, 1737 insertions(+) create mode 100644 research/complex-prefix-native-ports/.gitattributes create mode 100644 research/complex-prefix-native-ports/CHECKS.json create mode 100644 research/complex-prefix-native-ports/FULL-INPUT-PORT.md create mode 100644 research/complex-prefix-native-ports/LICENSE create mode 100644 research/complex-prefix-native-ports/MANIFEST.json create mode 100644 research/complex-prefix-native-ports/NOTICE.md create mode 100644 research/complex-prefix-native-ports/PREDECESSOR-NOTICE.md create mode 100644 research/complex-prefix-native-ports/README.md create mode 100644 research/complex-prefix-native-ports/SECTOR-COMPLETION.md create mode 100644 research/complex-prefix-native-ports/SOURCE-PINS.json create mode 100644 research/complex-prefix-native-ports/SOURCES.json create mode 100644 research/complex-prefix-native-ports/TASK.json create mode 100644 research/complex-prefix-native-ports/VERIFY.json create mode 100644 research/complex-prefix-native-ports/WORD-REVIEW.md create mode 100644 research/complex-prefix-native-ports/finite_geometry.py create mode 100644 research/complex-prefix-native-ports/pr4688/README.md create mode 100644 research/complex-prefix-native-ports/pr4710/README.md create mode 100644 research/complex-prefix-native-ports/pr4710/verify_residual.py create mode 100644 research/complex-prefix-native-ports/verify.py create mode 100644 research/complex-prefix-native-ports/verify_full_input_port.py create mode 100644 research/complex-prefix-native-ports/verify_native_interface.py create mode 100644 research/complex-prefix-native-ports/verify_sector_completion.py create mode 100644 research/complex-prefix-native-ports/verify_word_review.py diff --git a/research/complex-prefix-native-ports/.gitattributes b/research/complex-prefix-native-ports/.gitattributes new file mode 100644 index 0000000000..4f7fc3ef14 --- /dev/null +++ b/research/complex-prefix-native-ports/.gitattributes @@ -0,0 +1 @@ +* -text whitespace=cr-at-eol diff --git a/research/complex-prefix-native-ports/CHECKS.json b/research/complex-prefix-native-ports/CHECKS.json new file mode 100644 index 0000000000..32b03bc3d0 --- /dev/null +++ b/research/complex-prefix-native-ports/CHECKS.json @@ -0,0 +1,79 @@ +{ + "verify_sector_completion.py": { + "new_kappa": false, + "output_abi_pauli": { + "label_x_or_8z": 26, + "phase_i_exponent": 2 + }, + "paid_calls": 3, + "proof_scope": "base word identities tensorized separately; scalar coefficients outside tensor powers", + "sectors": [ + 1, + -1 + ], + "status": "PASS_THREE_CALL_SECTOR_COMPLETION", + "wrong_sign_rejections": 2 + }, + "verify_full_input_port.py": { + "arbitrary_independent_input_arrays": 2, + "euclidean_norm_bound": 4, + "inverse_norm_bound": 4, + "new_kappa": false, + "status": "PASS_FULL_INPUT_TRIANGULAR_PORT", + "three_call_port": { + "forward_paid_calls": 3, + "inverse_paid_calls": 3 + }, + "two_call_port": { + "forward_paid_calls": 2, + "inverse_paid_calls": 2 + } + }, + "verify_native_interface.py": { + "all_width_update_bound": "changed_digits < 8N/7", + "cases": 4, + "checked_entries": 149792, + "digit_updates": 171108, + "precision_error_factor_upper_bound": "10/64", + "status": "PASS_NATIVE_MONOMIAL_STREAM", + "widths": [ + 1, + 2, + 3, + 4, + 5 + ] + }, + "finite_geometry.py": { + "GL3_order": 168, + "H_symplectic_order": 10752, + "common_stabilizer_order": 768, + "new_kappa": false, + "quadratic_dual_character_orbits": [ + 1, + 7, + 7, + 21, + 28 + ], + "rank_one_neighbor_count": 14, + "stabilizer_neighbor_orbits": [ + 1, + 1, + 12 + ], + "status": "PASS_COMPLEX_THREE_AXIS_FINITE_GEOMETRY" + }, + "verify_word_review.py": { + "status": "PASS_INDEPENDENT_WORD_REVIEW", + "widths": [ + 1, + 2 + ], + "exact_vector_identities": 60, + "dirty_baseline_controls": 12, + "exact_coupling_inverse_checks": 3, + "new_kappa": false, + "all_width_basis": "separate tensorized word products; proof in WORD-REVIEW.md" + } +} diff --git a/research/complex-prefix-native-ports/FULL-INPUT-PORT.md b/research/complex-prefix-native-ports/FULL-INPUT-PORT.md new file mode 100644 index 0000000000..39a461f2fb --- /dev/null +++ b/research/complex-prefix-native-ports/FULL-INPUT-PORT.md @@ -0,0 +1,86 @@ +# Reversible two-call and three-call full-input triangular ports + +Prepared for Dugongue with substantial OpenAI Codex assistance. This is an exact, all-width native building block on two arbitrary independent input arrays. It does not claim an improved complete supplier or multiplication exponent. + +## Leading two-call theorem + +Let A_f = C0_f and L_f = P_f + 2 Q_f, with the individually tensorized phase letters pinned below. For two arbitrary independent initial registers (x,y), execute + + t <- A_f x, + y <- y + P_f t + 2 Q_f t, + s <- A_f y. + +Only the first and last lines are paid calls. The complete output is + + (t,s) = (A_f x, A_f y + A_f L_f A_f x). + +This is an actual dirty-target extension of the predecessor prefix: replace its initial copy by additive injection into the existing target. To implement a term P_f t using only per-register maps and ordinary mixing, apply P_f to t, add it into y, and restore t using P_f inverse; do the same for Q_f. No original y value is overwritten and no hidden clean copy is needed. + +The exact two-call block and its inverse are + + F_f = A_f L_f A_f, + U_f = [[A_f, 0], [F_f, A_f]], + U_f inverse = [[A_f inverse, 0], [-L_f, A_f inverse]]. + +The reverse program applies A_f inverse to s, subtracts the two separately applied monomial terms using retained t, and applies A_f inverse to t. Thus it costs exactly two inverse paid calls, each equivalent to one forward paid call plus a free X0_f. Both block multiplication orders verify the inverse. This result is valid for arbitrary x and y and every positive f. + +There is also an explicit free inverse for the coupling L_f. Set R_f = P_f inverse Q_f. The actual predecessor letters satisfy R^4 = I, hence R_f^4 = I. Then + + L_f inverse = -(I - 2 R_f + 4 R_f^2 - 8 R_f^3) P_f inverse / 15. + +Multiplying by P_f(I + 2 R_f) proves the formula. Every summand is applied separately; the four-term sum is never tensorized as one letter. The fixed denominator 15 requires explicitly charged fixed-precision scalar arithmetic for numerical execution. Since R_f is unitary with fourth-root-of-unity spectrum, L_f has singular values between 1 and 3. In addition, every R_f power times P_f inverse is monomial, so the explicit formula gives infinity norm(L_f inverse) <= (1 + 2 + 4 + 8)/15 = 1 uniformly in f. The forward and reverse two/three-call schedules do not execute this division by 15; it is an optional coupling inverse. If that optional inverse is used numerically, its fixed odd division and rounding must be charged explicitly, for example by ordinary bounded-word DIV with a sufficient common-grid guard. This well-conditioned free coupling is concrete controller material, rather than an unknown gadget or an inverse asserted from a numerical rank. + +The two-call block is a product of unitary layers and the shear (t,y) -> (t,y + L_f t). Its norm and inverse norm are at most 4, so its condition number is at most 16 uniformly in f. The three-call block below is this same block followed by another unitary layer, and inherits the identical bound. + +## Constructive full-input theorem + +Use the actual base letters and phases of the pinned PR #4710 residual identity, with notation as in SECTOR-COMPLETION.md. At every positive width f, each individual letter G_f means G raised to its f-fold tensor power. Put + + A_f = C0_f, + L_f = P_f + 2 Q_f, + D_f = J_f W_f C0_f, + B_f = M_f C2_f + 2 K_f a_f. + +For arbitrary independent complex arrays x and y of length N = 8^f, the following exact program uses three paid rank-one calls: + +1. Replace x by t = C0_f x. This is the first paid call. +2. Add P_f t and 2 Q_f t into the existing y register, obtaining y + L_f t. Each summand is a separately applied free monomial. The original y is retained additively; no zero-scratch precondition is used. +3. Apply C0_f to the second register. This is the second paid call. +4. Apply W_f and J_f to that register. Only the C2_f inside J is paid, giving the third call. + +The resulting two-register output is exactly + + (t,u) = (C0_f x, D_f y + B_f x). + +Indeed u = D_f y + J_f W_f C0_f (P_f + 2 Q_f) C0_f x, and the pinned predecessor identities, tensorized separately before addition, identify the two x summands with M_f C2_f x and 2 K_f a_f x. Nothing tensors the sum P + 2 Q as a single matrix. Absolute Pauli phases remain those of the source. + +The three-call map is invertible at every width. Its explicit reverse schedule is: apply J_f inverse, W_f inverse and C0_f inverse to u, subtract P_f t and 2 Q_f t, and apply C0_f inverse to t. This recovers exactly (x,y), with no borrowed copy. Each inverse Cj_f uses one forward paid call followed by Xj_f, since Cj inverse = Xj Cj on the actual base letters. Thus the reverse also uses three paid calls. In block form the forward and inverse are + + [[A_f, 0], [D_f L_f A_f, D_f]] + and [[A_f inverse, 0], [-L_f, D_f inverse]]. + +Both multiplication orders give the identity by literal block multiplication. This is a sufficient all-input implementation, not a rank-only test or a subspace assertion. + +## Conditioning, native work and precision + +Each paid Gaussian letter and each free monomial is unitary. The whole program is a product of unitary block-diagonal layers and the shear + + S_f(t,y) = (t, y + L_f t). + +As the two free terms in L_f have unitary Euclidean norm, norm(L_f) <= 3. Writing S_f = I + N_f, with N_f squared zero, gives norm(S_f) <= 4 and norm(S_f inverse) <= 4. Consequently both the complete forward operator and its inverse have Euclidean operator norm at most 4, and their condition number is at most 16, independently of f. This statement concerns the complete two-bank map, without discarding either output. + +For an explicit coordinatewise native error budget, let complex input magnitudes be at most 2^H and request coordinate error at most 2^(-P), where H,P >= 0. Let each charged Gaussian call return its exact transform of the stored input with error at most rho per coordinate, and quantize the original inputs with error at most rho. Set L = 2^(f/2), bounding the infinity norm of any Cj_f. Free monomials, integer scalings, copies and additions can be exact on the common grid. The first call's error contributes at most 3 L^2 rho to u, the second at most L rho, and the third at most rho. Initial input errors contribute at most (3 L^3 + L^2) rho to u. Thus the conservative bound 10 L^3 rho covers both output arrays. Taking rho = 2^(-(P + 2 f + 6)) gives error below 2^(-P), since L^3 <= 2^(2 f) and 10/64 < 1. Any chosen Gaussian implementation's internal guard and time costs are separately charged; this theorem does not assume an unproved fast oracle. + +Intermediate magnitudes are below 2^(H + 2 f + 4), including these errors. P + H + 4 f + 12 signed bits per real or imaginary coordinate suffice for the displayed arithmetic. If f = O(log p), H,P = O(p) and p = Theta(log n), this occupies a fixed number of ordinary C log n-bit words, for sufficiently large fixed C. No unbounded-word multiplication or whole-array unit instruction is used. + +The address/phase odometer and explicit in-place permutation implementation in SECTOR-COMPLETION.md implement every displayed free map and mixed update in O(N) ordinary word operations. O(N) owned address workspace, or one separately owned work field, is initialized and restored in O(N) stores. These are charged native resources, not additional independent productive inputs. The theorem therefore supplies three paid calls plus O(N) native work, with two arbitrary input banks and explicitly accounted workspace. + +## How to use the port without changing its claim + +A controller may now wire this full-input block into a larger exact block identity, preserving both diagonal channels and the actual rank-three off-diagonal term. This differs from the clean-prefix presentation because the second initial array is arbitrary and its D_f y contribution is explicit. A claimed complete saving must show the actual subsequent block operations, canonical independent outputs, restored owners and total paid calls. This port alone has diagonal ranks one and two and does not establish a three-rank target for both independent arrays. Discarding D_f y, assuming it is initially zero, or counting B_f x as an independent additional Gaussian job would change the theorem. + +## Evidence and predecessor credit + +verify_full_input_port.py uses the pinned exact Gaussian-rational engine to verify both predecessor word identities, both full-input triangular blocks, both inverse multiplication identities, the order-four free coupling inverse and the one-call implementation of paid inverses. It rejects the false claim that the second output is independent of an arbitrary y. Separately tensorized word algebra proves all widths; the finite checks do not infer universal correctness from a few dimensions. + +Credit Yiyang / Lyy-iiis, PR #4710 (b0d5192390af493d626054b060921895df3c94d2), for the repaired phase prefix and residual identity; lee-phys, PR #4688 (264c4b3cb13c82d171de352ecf60486dfb8d2bd4), for the original prefix and rank engine; and Jacob Alan Sussman, PR #4628 (ee4fd87f064017c23e5a86fc1dcfe0a5237caed3), for the complex engine model and small-unit problem. Retain their notices and earlier attribution. This full-input additive schedule, reverse interface and uniform norm bound are the present extension. No worldwide novelty or independent human review is claimed. Exact source URLs and SHA-256 pins appear in SOURCE-PINS.json. diff --git a/research/complex-prefix-native-ports/LICENSE b/research/complex-prefix-native-ports/LICENSE new file mode 100644 index 0000000000..261eeb9e9f --- /dev/null +++ b/research/complex-prefix-native-ports/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/complex-prefix-native-ports/MANIFEST.json b/research/complex-prefix-native-ports/MANIFEST.json new file mode 100644 index 0000000000..e786465262 --- /dev/null +++ b/research/complex-prefix-native-ports/MANIFEST.json @@ -0,0 +1,24 @@ +{ + ".gitattributes": "730a35ae3d558080083c3103d9ac8100c3f6561678092abe341701dfa331eb1d", + "CHECKS.json": "573e90be758be8a89bda3ae4460f03cfc4ba172912a295d99ffcc56e86534aad", + "finite_geometry.py": "93a1c01726b4983250892b199e427e496065db77316513df103ea8366d06b729", + "FULL-INPUT-PORT.md": "52b8462e28f9e87925ccfea27872630e2b2da23f19fd3d2265c2654bc016088c", + "LICENSE": "c71d239df91726fc519c6eb72d318ec65820627232b2f796219e87dcf35d0ab4", + "NOTICE.md": "04a7423af5af1f5c2e9e2772fb1e3bfeb6158abb1464bfe3ffad7f00b7946782", + "pr4688/README.md": "91d45b5af6063e30c6860a4cb46cfc44960ecd67f37c3bce9675924e30b89b4e", + "pr4710/README.md": "e866032429cb032f55edc9b2f3c6535ecf37680aae7cd9e8bb9b8cc21617aa64", + "pr4710/verify_residual.py": "0d277854396e4ceda1e0f26916bd576b6decb474c0692b6671ebf2595283ddb9", + "PREDECESSOR-NOTICE.md": "ce5225232738618bcdec9c3b468af965d1953abf62f93f3ee1c335bb831fbe62", + "README.md": "bc9dd236445665cb7ea8fdd6b1c3783e70018ec0fbe19ad1a756fb4e80f40f6f", + "SECTOR-COMPLETION.md": "2e72e19c4733213d1875f60cf87eddb733dde9266cf2581cb56393c3fabf1933", + "SOURCE-PINS.json": "9d039350b6fcba24dda2ec603dab2083ff8cc7c671c374d849b1c76b431aec0a", + "SOURCES.json": "918c9cbe30ff30332defb39b3ce6d5cea4c16f4f51853910ab5d83a6546a4582", + "TASK.json": "d21946e4d7a65b2ee0cb93329de1234688f297b2eefb55136e430d91272d7cf2", + "VERIFY.json": "bef5ec6da3d1c6d033131f9fa37e84af18d3edd364b8194ad5bd320306e393a3", + "verify.py": "8801bd2eae1ed78dc92ec70e8d0f51e590120e2df8fb6e9230c750ea9fd805a7", + "verify_full_input_port.py": "51a690ad73e60ce6f4e71231ab647059cc6da5381b0eb831f8fd3cac1f47174d", + "verify_native_interface.py": "43f3e4ad98ece54d2a9753bc967162f5bd28c53a7f47cc4630d77f7b50af50b5", + "verify_sector_completion.py": "56aaddc8c8241b6624f5128c24325b904bf50e84149a0b73d104a23a00028c5b", + "verify_word_review.py": "5e8dc00e42ebc9eb2e3f5eca2bc225a32e709113712b74eb84dbe552b4ef8c5f", + "WORD-REVIEW.md": "f3103fc390ae5f11a663513fd854667eed79a90ed74307f0c9e962e280186bc9" +} diff --git a/research/complex-prefix-native-ports/NOTICE.md b/research/complex-prefix-native-ports/NOTICE.md new file mode 100644 index 0000000000..6f2cac2711 --- /dev/null +++ b/research/complex-prefix-native-ports/NOTICE.md @@ -0,0 +1,9 @@ +# Attribution + +Prepared for Dugongue with substantial OpenAI Codex assistance from four workers. Apache-2.0. Independent agent review is AI review, not human peer review or a Lean kernel certificate. + +Yiyang (@Lyy-iiis), PR #4710 at b0d5192390af493d626054b060921895df3c94d2, supplies the phase repair, actual Gaussian-rational residual engine and separately tensorized residual identities. Its engine and README are retained byte for byte. The exact predecessor notice is PREDECESSOR-NOTICE.md. + +lee-phys, PR #4688 at 264c4b3cb13c82d171de352ecf60486dfb8d2bd4, supplies the original two-image prefix and rank engine. Its README is retained unchanged for credit; its rank engine is not needed or rerun here. Jacob Alan Sussman, PR #4628 at ee4fd87f064017c23e5a86fc1dcfe0a5237caed3, supplies the complex small-block engine problem and hook lower-bound framework. All retained predecessor notices and assistance disclosures remain in force. + +The new scope is an arbitrary-second-input port and explicit reverse schedule, a phase-correct swap-sector continuation, the accompanying native address/precision contract, and an exact finite geometry search coordinate system. The underlying prefix and residual identity are predecessor results. No worldwide novelty or new multiplication exponent is claimed. diff --git a/research/complex-prefix-native-ports/PREDECESSOR-NOTICE.md b/research/complex-prefix-native-ports/PREDECESSOR-NOTICE.md new file mode 100644 index 0000000000..91b45680f7 --- /dev/null +++ b/research/complex-prefix-native-ports/PREDECESSOR-NOTICE.md @@ -0,0 +1,7 @@ +# Attribution and provenance + +The unchanged files `vendor/pr4688/verify.py` and `vendor/pr4688/README.md` come from `research/complex-two-image-hook-prefix/` in lee-phys's CrocSwap/integer-mult-bounds PR #4688, commit `264c4b3cb13c82d171de352ecf60486dfb8d2bd4`. Their mathematical construction, model, rank engine, calibrations and seven controls are credited to that work. This package's main checker reuses the engine's sparse Gaussian arithmetic and exterior-power routines. + +Jacob Sussman's PR #4628, commit `ee4fd87f064017c23e5a86fc1dcfe0a5237caed3`, and its source repository jacobalansussman/wht-power-saving-lean, commit `86e575e28ed94890872dcff1bb2621d7ff559cbd`, are the sources of the block-3 engine model, the 14W/5 hook bound, the single-image obstruction and the singular-frame subgame motivating the phase repair. The present obstruction uses an explicit joint-target rank and does not depend on an unimplemented singular-frame theorem. + +New work in this package: the fresh-input target-deficit obstruction; the explicit S U S / S V S phase repair; the exact joint-rank and four-point-pencil calculations; the higher-width lifted-hook argument; and the independently checked residual interface when included. This work was produced by OpenAI Codex agents acting for Lyy-iiis. No contribution by the predecessors is claimed as new, and no Lean or human verification is claimed. diff --git a/research/complex-prefix-native-ports/README.md b/research/complex-prefix-native-ports/README.md new file mode 100644 index 0000000000..b24dd74895 --- /dev/null +++ b/research/complex-prefix-native-ports/README.md @@ -0,0 +1,50 @@ +# Reversible native ports for the repaired complex prefix + +For every positive tensor width, the repaired two-call prefix extends to **two arbitrary independent input arrays**, with an explicit two-call reverse and Euclidean condition number at most 16. Its third-call lift exposes the exact target-bearing residual on a dirty target. On either explicitly stated swap sector, a free residual subtraction completes the canonical rank-three target in three calls. These are sufficient implementation theorems with proofs, not just rank tests. + +**No improved κ, complete five-input/fourteen-call unit, or complete multiplication theorem is established.** The two-call port's independent diagonal outputs each have rank one; its off-diagonal term is dependent information. The three-call port has diagonal ranks one and two. Neither interface licenses credit for an extra independent rank-three output. The selected conditional frontier remains 0.00302015 (#4470); the stronger open 0.0030217758 claim (#4610/#4713) is not surpassed here. + +The useful change from #4710 is that the second bank is arbitrary and remains explicitly present throughout the interface and inverse. A controller can now compose a literal reversible block instead of assuming a clean scratch target. The source prefix, phase repair and residual word identities remain credited to their predecessors. + +## Proofs and implementation + +- [FULL-INPUT-PORT.md](FULL-INPUT-PORT.md): exact two- and three-call schedules, both inverse orders, uniform conditioning, and a bounded-word precision contract. +- [SECTOR-COMPLETION.md](SECTOR-COMPLETION.md): canonical output on both swap sectors, absolute Pauli phase, an all-width identity criterion, and O(N) native address/phase generation for N = 8^f. +- [WORD-REVIEW.md](WORD-REVIEW.md): independent agent review of the universal algebra and finite replay. + +All tensor powers apply to individual letters before scalar mixing. Tensoring the whole sum would give a different algorithm. The native implementation charges array passes, owned workspace initialization and cleanup. Its two- and three-call schedules use only dyadic mixing. The optional mathematical inverse of P_f + 2 Q_f has denominator 15 and is outside those native schedules; numerical use needs its own exact-grid or rounded-arithmetic invoice. + +## Reproduce + +Python 3.12 or later and the standard library suffice on Windows, Linux or macOS. From any working directory: + +```sh +python3 -I -B /path/to/research/complex-prefix-native-ports/verify.py +python3 -I -O -B /path/to/research/complex-prefix-native-ports/verify.py +``` + +Expected final line: `PASS_COMPLEX_PREFIX_NATIVE_PORTS`. + +The registered repository replay is: + +```sh +python3 -B scripts/research_package.py --package research/complex-prefix-native-ports +``` + +The verifier authenticates every package file and the unchanged predecessor residual engine, then runs exact Gaussian-rational block/sector checks, an independently implemented vector replay at widths 1 and 2, the native odometer check, and a finite geometry census. Expected deterministic receipts are in CHECKS.json. The finite checks corroborate the written all-width proofs; they do not replace them. No network, solver, GPU, Lean, Docker or complete selected-supplier replay is required or claimed. Committed-byte preflight passes. Full source-history preflight could not complete in this shallow checkout; the exact main parent and declared provenance objects are available, but a full-history ancestry audit is not claimed. + +## Frontier and overlap + +Canonical main was fetched repeatedly at b58ad9ef4d4e861b0eaa5dba41742bdc072dca51. The live PR-body search was refreshed through #4740, including #4710, #4713, #4717, #4724–#4729 and #4733–#4740. The newer centre-code and response packages explicitly use historical inputs and do not claim a higher complete κ. The overlap helper could not refresh Discussions because its API request was rate-limited; the local checkout covered only 7 note records out of 5,860 tracked note paths. No exhaustive novelty claim follows. + +The broader four-worker investigation also examined the actual #4610/#4694 reader, its E₈ geometry, and guarded owned-zero specialization. Those experiments are preserved outside this focused package. An early positive specialization was rejected because an initial owned-centre CLEAR had accidentally erased an independent helper input; it is not evidence for an improved bound. The final claims here do not use that parser or witness. Canonical Lean sources and the authoritative DAG were not modified. Targeted library retrieval was source-level discovery, not a new Lean audit. + +## Open next questions + +1. Compose the arbitrary-target block into a complete five-input/fourteen-call unit, retaining all independent outputs and paying every call. The full block and explicit inverse provide a concrete starting interface. +2. Find a nonmonomial free group-algebra encoding that cancels the residual across channels without discarding complementary input pieces. The exact 14-neighbor geometry is a search coordinate system; its symplectic quotient alone omits phases. +3. If using a dyadic degeneration, prove stability and precision for the complete recursive substitution. Fixed Laurent degree in one macro does not by itself bound the degree or precision of the recursive algorithm. + +## Credit + +Prepared for Dugongue with substantial OpenAI Codex assistance from four workers. Credit Yiyang (@Lyy-iiis), [#4710](https://github.com/CrocSwap/integer-mult-bounds/pull/4710), for the phase repair and residual identity; lee-phys, [#4688](https://github.com/CrocSwap/integer-mult-bounds/pull/4688), for the original two-image prefix and rank engine; and Jacob Alan Sussman, [#4628](https://github.com/CrocSwap/integer-mult-bounds/pull/4628), for the complex engine problem and hook framework. Exact heads, URLs and SHA-256 hashes are in SOURCE-PINS.json; original notices are retained in PREDECESSOR-NOTICE.md and the unchanged source READMEs. See NOTICE.md and LICENSE. Independent review here means a separate Codex worker, not human peer review or a formal kernel certificate. diff --git a/research/complex-prefix-native-ports/SECTOR-COMPLETION.md b/research/complex-prefix-native-ports/SECTOR-COMPLETION.md new file mode 100644 index 0000000000..d3fcedfa0e --- /dev/null +++ b/research/complex-prefix-native-ports/SECTOR-COMPLETION.md @@ -0,0 +1,93 @@ +# A three-call completion of the repaired prefix on swap sectors + +Prepared for Dugongue with substantial OpenAI Codex assistance. This is a sufficient all-input theorem on two explicitly stated input subspaces. It is not a five-array, fourteen-call unit and establishes no improved multiplication κ. + +## Constructive theorem + +Let V = C^8, let C_j = ((1+i)/2)I + ((1−i)/2)X_j, and put K=C_2 C_1 C_0. At every positive digit width f, write G_f = G^(tensor f) for each individual base letter G. Let T exchange address bits 0 and 2 and let σ be either +1 or −1. Suppose the input x satisfies T_f x = σ x. Then the target K_f x can be obtained by completing the actual PR #4710 two-call prefix with **one further paid call**, free maps/mixing and free scratch erasure. The total is three rank-one calls, with two data registers and no unaccounted extra input copy. + +This theorem gives an actual continuation on both swap sectors, rather than only a rank or target-alignment test. The eigenspace can be prepared explicitly by e_σ=(I+σT_f)/2 when its complementary piece is retained elsewhere. Preparing that projector is not a license to erase the complementary piece of an arbitrary full input. + +## Exact program and proof + +Use the actual repaired prefix of Yiyang’s PR #4710, built on lee-phys’s PR #4688: + + S e_x = i^popcount(x) e_x, + U = CNOT(0 to 2), V01 = SWAP(0,1), + P = S U S, Q = S V01 S, + F_f = C0_f (P_f + 2 Q_f) C0_f. + +Execute its two-register schedule but retain the state immediately before the optional final erasure: + + t = C0_f x, s = F_f x. + +For the Q branch restore t using Q_f^−1, as in the repaired prefix. Its two paid calls and initial zero scratch are the actual predecessor schedule; neither P_f+2Q_f nor F_f is tensorized as a whole sum. + +The predecessor’s exact separately tensorizable word identities give + + J_f W_f s = M_f C2_f x + 2 K_f a_f x, + +where + + J = Z1 V01 C2 (one paid call), + W = Z0 Z2, + M = X1 V01 CNOT(2 to 0) Z1 S2 CZ02, + a = Y0 Z1. + +All of W,M,a are admitted free monomial letters or fixed free words. Apply W and then J to s, and call the resulting register u. Since T C0 T=C2 and T_f x=σx, + + C2_f x = T_f C0_f T_f x = σ T_f t. + +Consequently the free update + + u <- (u − σ M_f T_f t)/2 + +returns K_f a_f x. The actual free Pauli + + B = K a K^−1 = −Z0 Y1 + +satisfies B_f^−1 K_f a_f=K_f. Applying B_f^−1 to u therefore returns the canonical target K_f x. Erase t by the same permitted singular free mixing convention as the predecessor and rename u as the output. The initially zero scratch is again zero. The only additional paid operation was the C2 inside J. This proves the construction at every f and for every vector in the stated sector. + +Every product identity used above is first checked on the actual base letters and then tensorized **separately**. Coefficients 2, σ and 1/2 remain outside tensor powers. In particular the minus sign in B contributes (−1)^f inside B_f; replacing it by a width-independent minus sign would change the identity at even widths. + +The maps P,Q,J,W,M,T and B are unitary. The prefix has Euclidean operator norm at most 3, and the newly completed formula uses one subtraction and a factor 1/2. This is a bounded explicit local arithmetic program. It does not replace the full native caller’s coordinatewise precision, conditioning, grouping or recovery analysis. + +## Native implementation and sufficient precision + +The sector continuation has an explicit bounded-array implementation. Let N = 8^f, let the ideal input have complex coordinate magnitudes at most 2^H, and request final absolute coordinate error at most 2^(-P). Assume each of the three charged rank-one Gaussian calls, on its actual input, returns its exact result with coordinate error at most rho. This is a stated accuracy contract for the existing Gaussian implementation, not an assumed new fast transform. All other address permutations and phases are exact; copies and erasures are ordinary charged array passes. Each scalar addition, shift or division is performed on a common dyadic grid with rounding error at most rho. + +Choose rho = 2^(-(P + 2 f + 6)). Write L = 2^(f/2), an upper bound on the infinity operator norm of each Cj_f. Free monomial maps have infinity norm 1. The first output t has error at most rho from its Gaussian call. Its mixed input P_f t + 2 Q_f t has error at most 3 rho. After the second Gaussian call, its error is at most (3 L + 1) rho. After the third call J and the final residual subtraction and division by 2, the error is at most 4 L^2 rho when exact dyadic additions are used and only that final division rounds. Allowing a further fixed-grid rounding at each displayed scalar operation, and initial input quantization of complex error at most rho, gives the conservative bound 10 L^3 rho. This is less than 2^(-P) for every f >= 1. Initial quantization need not preserve the sector relation exactly: its discrepancy is included by applying the fixed linear completed program to the input error, whose infinity norm is bounded by the same conservative factor. + +To justify the conservative constant without relying on cancellation, propagate errors through the actual schedule: input quantization contributes at most ((3 L^3 + L)/2) rho <= 2 L^3 rho; the first call contributes the same bound; the middle update contributes at most (L^2/2) rho; the second call contributes at most (L/2) rho; the third contributes at most rho/2; and the final division contributes at most rho. Their sum is at most 7 L^3 rho, hence below the stated bound 10 L^3 rho. Multiplication by 2, permutations, phases and copies are exact. Complex grid rounding is required to meet the stated complex-error bound rho, for example by rounding real and imaginary coordinates to half that tolerance. + +Every exact intermediate coordinate is bounded by 3 L^3 2^H; increasing this to 2^(H + 2 f + 4) accommodates the stated rounding errors when H,P >= 0. A signed representation with P + H + 4 f + 12 bits per real or imaginary component therefore suffices for the displayed program. The Gaussian implementation's own separately charged internal guard is additional to this interface allocation. For f = O(log p), H,P = O(p) and p = Theta(log n), each field entry occupies a fixed number of ordinary C log n-bit words for a sufficiently large fixed C. No entire array is treated as a unit-cost word, and no unbounded-word multiplication primitive is used. + +The displayed free schedule uses only a fixed number of passes over the two N-entry data fields. Every free letter is a fixed base-8 tensor monomial, so its address and phase stream can be generated in O(N) ordinary bounded-word operations. Maintain the f base-8 digits, the mapped address and the phase exponent modulo 4. On a carry, change only the affected digit contributions. The total number of changed digits over a complete N-address traversal is at most N + N/8 + N/8^2 + ... < 8N/7. A changed digit uses fixed table lookups, a shift by its precomputed place and a constant number of additions and bit operations. Initialization costs O(f), which is O(N). No multiplication or division instruction is needed by this address generator. + +For an explicit in-place implementation, generate and store the N-entry permutation table with that odometer, traverse its cycles using an N-bit visited table and one temporary complex entry, and then clear both tables. This uses O(N) owned address workspace, charged O(N) stores for initialization and restoration, and does not borrow either data register as hidden independent input. The phase table can be generated in the same stream and applied in one additional pass. Alternatively a separately owned N-entry work field permits direct out-of-place scatter followed by copy-back and clear. Either implementation gives O(N) free-operation work and O(N) owned words in addition to the three charged Gaussian calls. A final clear costs N stores and restores the data scratch. The two-register claim refers to the algebraic data interface; native address workspace is explicitly charged here. This proves a costed, precision-explicit native subroutine on either stated sector; it does not create an independent full-array productive job or improve the complete supplier exponent by itself. + +## An exact all-width identity criterion for further synthesis + +Let g_1,…,g_D be pairwise distinct nonzero base matrices over C. If fixed scalars c_j satisfy + + sum_j c_j g_j^(tensor f) = 0 for every positive integer f, + +then every c_j is zero. Indeed choose a linear functional ℓ on the finite-dimensional matrix space such that the numbers λ_j=ℓ(g_j) are all distinct and nonzero. Such ℓ exists because the finitely many conditions ℓ(g_j)=0 and ℓ(g_j−g_k)=0 exclude only proper hyperplanes. Contracting the tensor identity by ℓ^(tensor f) gives sum_j c_j λ_j^f=0 for f=1,…,D. Its determinant is the nonzero Vandermonde product times product_j λ_j, so all coefficients vanish. + +Thus a fixed-coefficient finite word identity valid at every width can be verified by exact coefficient collection on the distinct actual base matrices. This justifies a finite group-algebra representation for searches using the finite Clifford group. It requires the **actual** matrices, including scalar phases. Projectively equal matrices with different phases cannot simply be merged. Width-dependent mixing coefficients require their own contract and are outside this fixed-coefficient statement. + +## Finite geometry for a larger continuation + +The standalone exact `finite_geometry.py` independently constructs the 10,752-element symplectic quotient of the free monomial-Clifford subgroup, its 14 rank-one Lagrangian neighbors and the 768-element common stabilizer of the reference and called Lagrangians. The stabilizer’s neighbor orbit sizes are 1,1,12. The dual quadratic-character orbit sizes under GL_3(F_2) are 1,7,7,21,28. This is an explicit finite search coordinate system; the quotient does not preserve the Pauli/central phases and is not itself a certificate for an all-width unit. + +A useful extension of the sector port uses H-valued encodings. If A is an explicit free group-algebra coefficient, T A=B0 A, and B0 is free with C0 B0 C0^−1 also free, then + + C2 A = (T C0 B0 C0^−1) C0 A. + +The proof is literal multiplication of T C0 T A and the assumed equality T A=B0 A. This supplies a concrete residual-cancellation port for an encoded channel. Any larger use must exhibit the actual coefficients and an injective complete input encoding, retain all complementary pieces, and count every call. No such five-in-fourteen continuation is claimed here. + +## Evidence and credit + +`verify_sector_completion.py` authenticates the pinned predecessor residual checker, independently assembles the actual Gaussian-rational matrices, verifies both sector projectors and completed targets, checks B’s absolute phase and rejects both wrong residual signs. Its finite matrix checks corroborate the separately tensorized all-width proof above. `finite_geometry.py` uses only exact binary arithmetic; no floating rank, solver, Lean build or full multiplication replay is involved. + +Credit Yiyang / Lyy-iiis’s PR #4710 at b0d5192390af493d626054b060921895df3c94d2 for the repaired two-call prefix and residual identity; lee-phys’s PR #4688 at 264c4b3cb13c82d171de352ecf60486dfb8d2bd4 for the original prefix, inverse and rank engine; Jacob Alan Sussman’s PR #4628 at ee4fd87f064017c23e5a86fc1dcfe0a5237caed3 for the complex engine model and small-block problem; and their retained predecessors. Source URLs and hashes are in SOURCE-PINS.json. The new material is the explicit swap-sector completion and its canonical-output correction, plus the stated group-algebra synthesis criterion. No worldwide novelty or independent human review is claimed. diff --git a/research/complex-prefix-native-ports/SOURCE-PINS.json b/research/complex-prefix-native-ports/SOURCE-PINS.json new file mode 100644 index 0000000000..669c5d6be7 --- /dev/null +++ b/research/complex-prefix-native-ports/SOURCE-PINS.json @@ -0,0 +1,22 @@ +[ + { + "url": "https://raw.githubusercontent.com/CrocSwap/integer-mult-bounds/b0d5192390af493d626054b060921895df3c94d2/research/phase-aligned-two-call-prefix/README.md", + "sha256": "e866032429cb032f55edc9b2f3c6535ecf37680aae7cd9e8bb9b8cc21617aa64", + "file": "pr4710/README.md" + }, + { + "url": "https://raw.githubusercontent.com/CrocSwap/integer-mult-bounds/b0d5192390af493d626054b060921895df3c94d2/research/phase-aligned-two-call-prefix/verify_residual.py", + "sha256": "0d277854396e4ceda1e0f26916bd576b6decb474c0692b6671ebf2595283ddb9", + "file": "pr4710/verify_residual.py" + }, + { + "url": "https://raw.githubusercontent.com/CrocSwap/integer-mult-bounds/264c4b3cb13c82d171de352ecf60486dfb8d2bd4/research/complex-two-image-hook-prefix/README.md", + "sha256": "91d45b5af6063e30c6860a4cb46cfc44960ecd67f37c3bce9675924e30b89b4e", + "file": "pr4688/README.md" + }, + { + "file": "PREDECESSOR-NOTICE.md", + "url": "https://raw.githubusercontent.com/CrocSwap/integer-mult-bounds/b0d5192390af493d626054b060921895df3c94d2/research/phase-aligned-two-call-prefix/NOTICE.md", + "sha256": "ce5225232738618bcdec9c3b468af965d1953abf62f93f3ee1c335bb831fbe62" + } +] diff --git a/research/complex-prefix-native-ports/SOURCES.json b/research/complex-prefix-native-ports/SOURCES.json new file mode 100644 index 0000000000..4916cee8e5 --- /dev/null +++ b/research/complex-prefix-native-ports/SOURCES.json @@ -0,0 +1,18 @@ +{ + "schema_version": 1, + "base_commit": "b58ad9ef4d4e861b0eaa5dba41742bdc072dca51", + "files": [ + { + "path": "certificates/selected-result.json", + "usage": "provenance", + "git_blob": "c35482cd9035843b15a634cc8276a7e1e40e8395", + "sha256": "6fe0a099b89aa2aed796a13c3a21dafc63f3388ebf397464e44e0451893b9375" + }, + { + "path": "docs/research/agent-task-catalog.json", + "usage": "provenance", + "git_blob": "f126dd2e2dad2b669e75d1d0d0bd05c600725602", + "sha256": "f7a48bfa2659b88378282a8eee7d9fe52cdf505594124c4d1686b58510fffd72" + } + ] +} diff --git a/research/complex-prefix-native-ports/TASK.json b/research/complex-prefix-native-ports/TASK.json new file mode 100644 index 0000000000..ad1dc08d95 --- /dev/null +++ b/research/complex-prefix-native-ports/TASK.json @@ -0,0 +1,78 @@ +{ + "schema_version": 1, + "task_id": "complex-rank-shape-decoder", + "priority_revision": 7, + "base_commit": "b58ad9ef4d4e861b0eaa5dba41742bdc072dca51", + "original_card": { + "id": "complex-rank-shape-decoder", + "question": "Can a decoder deliver the local paid mass in fewer, larger-rank children (block frame climbs instead of rank-1 to rank-3 steps)?", + "starting_points": [ + "docs/research/research-family-status.md", + "research/complex-local-word-ceiling/README.md", + "research/complex-decoder-field-extension-seed44/README.md", + "research/complex-frame-pair-decoders/README.md", + "research/selected-k8-unrestricted-ends/README.md", + "research/eisenstein-reduction-copy-floor/README.md" + ], + "methods": [ + "Find one exact small decoding identity whose frame path climbs in blocks, and price its complete per-call profile.", + "Bound the best effective child rank achievable for one fixed support alphabet, including copies, frames and restoration." + ], + "acceptance_gate": "A per-call local profile, with all copied information, frames and restoration counted, whose ceiling exceeds the selected word's by at least 5%; masked or overcomplete supports must change an assumption of the eight-term all-pairs bound. A scoped local result may be retained without a complete supplier. Expanding it into further construction rounds requires the family-level budget and obligation gate in research-family-status.md; an optimistic passing relaxation alone is not acceptance.", + "first_step": { + "command": [ + "python3", + "-B", + "research/complex-local-word-ceiling/verify.py" + ], + "expected": "PASS_COMPLEX_LOCAL_WORD_CEILING", + "inspect": "Read the selected word's per-call local profile, its packing ceiling and the lever table; run levers.py for the ideal budget of the lever you target.", + "scope": "Positive control and planning budget only; this is not a new construction or full cold replay." + }, + "first_experiment": "Before any synthesis, write the candidate per-call local profile (and centre charge / unpaid coordinates if changed) and screen it with ceiling.ceiling(); reject it if even the ideal ceiling does not beat the selected word's by your stated margin. Ideal budget: rank-16 delivery is 2.31x (levers.py).", + "bottleneck_link": "Rank-1 children are about half of recursive cost; the selected word's effective child rank is about 3.9. Larger-rank delivery lowers recursive cost per unit of paid mass.", + "allowed_variations": [ + "One masked, overcomplete or block decoder family with exact labels and supports.", + "A scoped lower bound on effective rank for one alphabet.", + "If the coverage law, template or guard changes, derive an applicable fully charged replacement bound instead of applying the incumbent ceiling outside its scope." + ], + "scope_change_triggers": [ + "Repacking idle remainders of an unchanged word (covered by the packing ceiling).", + "Repeating the eight-term all-pairs search inside its proved scope.", + "Only changing helper terminal subspaces and monotone frames within the fixed scalar word, entrances and cleanup contract already covered by #1995/#2013.", + "Searching below C=40 in the #2017 Eisenstein binary scalar-rectangle or fixed-support block-linear additive pairing model; specify a changed premise instead. This bound does not cover every complex decoder.", + "Continuing a partial cost improvement while leaving the same unpriced consumer, restoration or central-readout obligation unresolved; refresh the family expansion decision first. Local product-retiming evidence has a narrow scope and is not a ban on changed graphs or contracts." + ], + "overlap_terms": [ + "rank shape", + "block climb", + "masked decoder", + "overcomplete", + "effective rank" + ] + }, + "scope_status": "changed", + "actual_scope": "Construct and check reversible full-input ports and a swap-sector continuation of the current complex two-call prefix.", + "scope_change_reason": "A changed small-block mechanism following PRs 4628, 4688 and 4710; this is a scoped sufficient construction, not another fixed-inventory rank-shape scan or a complete call-saving supplier.", + "bottleneck_link": "A five-array/fourteen-call complex block would change the paid recursion. This contribution removes the zero-target restriction and makes the exact residual/independent diagonal channels available to a future controller. It does not supply that controller.", + "budget_minutes": 60, + "stop_rule": "Stop discovery after 45 minutes; retain frozen useful positive constructions and spend the final quarter on exact replay and handoff. Reject any output whose independent input has been cleared.", + "outcome": "partial", + "evidence": "Exact forward/reverse block identities; separately tensorized residual proof; native address and guard bounds; normal and optimized offline replays including independent width-1/2 vectors.", + "author": "Dugongue", + "ai_assistance": "Substantial OpenAI Codex assistance from four workers; no human peer review or Lean formalization.", + "open_questions": [ + { + "question": "Can the two-call arbitrary-target port enter a complete five-input/fourteen-call word?", + "why_it_matters": "That would change the paid complex recursion, whereas these component identities alone do not.", + "first_step": "Compose the literal block U with explicit free maps while retaining both independent diagonal channels; check all-width word coefficients before pricing.", + "blocked_by": "No complete independent-output controller is known in this package." + }, + { + "question": "Can a fixed-degree dyadic degeneration give a complete call-saving word?", + "why_it_matters": "A fixed-degree approximation can have a bounded-word precision contract, unlike an unpriced growing-degree degeneration.", + "first_step": "Exhibit an actual Laurent-polynomial word and prove its leading canonical outputs, error order and guard bill.", + "blocked_by": "No such degeneration is constructed here." + } + ] +} diff --git a/research/complex-prefix-native-ports/VERIFY.json b/research/complex-prefix-native-ports/VERIFY.json new file mode 100644 index 0000000000..5e13aae1af --- /dev/null +++ b/research/complex-prefix-native-ports/VERIFY.json @@ -0,0 +1,54 @@ +{ + "schema_version": 1, + "status": "ready", + "python": "3.12", + "requirements": [], + "inputs": [ + "research/complex-prefix-native-ports/.gitattributes", + "research/complex-prefix-native-ports/CHECKS.json", + "research/complex-prefix-native-ports/FULL-INPUT-PORT.md", + "research/complex-prefix-native-ports/LICENSE", + "research/complex-prefix-native-ports/MANIFEST.json", + "research/complex-prefix-native-ports/NOTICE.md", + "research/complex-prefix-native-ports/PREDECESSOR-NOTICE.md", + "research/complex-prefix-native-ports/README.md", + "research/complex-prefix-native-ports/SECTOR-COMPLETION.md", + "research/complex-prefix-native-ports/SOURCE-PINS.json", + "research/complex-prefix-native-ports/SOURCES.json", + "research/complex-prefix-native-ports/TASK.json", + "research/complex-prefix-native-ports/VERIFY.json", + "research/complex-prefix-native-ports/WORD-REVIEW.md", + "research/complex-prefix-native-ports/finite_geometry.py", + "research/complex-prefix-native-ports/pr4688/README.md", + "research/complex-prefix-native-ports/pr4710/README.md", + "research/complex-prefix-native-ports/pr4710/verify_residual.py", + "research/complex-prefix-native-ports/verify.py", + "research/complex-prefix-native-ports/verify_full_input_port.py", + "research/complex-prefix-native-ports/verify_native_interface.py", + "research/complex-prefix-native-ports/verify_sector_completion.py", + "research/complex-prefix-native-ports/verify_word_review.py" + ], + "commands": [ + { + "argv": [ + "{python}", + "-I", + "-B", + "{package}/verify.py" + ], + "timeout_seconds": 180, + "checks": "Exact source inventory, block/inverse/sector identities, independent vectors, native odometer and finite geometry." + }, + { + "argv": [ + "{python}", + "-I", + "-O", + "-B", + "{package}/verify.py" + ], + "timeout_seconds": 180, + "checks": "Repeat the same rejecting checks with assertions disabled." + } + ] +} diff --git a/research/complex-prefix-native-ports/WORD-REVIEW.md b/research/complex-prefix-native-ports/WORD-REVIEW.md new file mode 100644 index 0000000000..70d15cf0fd --- /dev/null +++ b/research/complex-prefix-native-ports/WORD-REVIEW.md @@ -0,0 +1,45 @@ +# Independent review of the dirty-target prefix and sector continuation + +This review accepts the stated interfaces and does not certify a new multiplication exponent. The predecessor is the phase-repaired prefix of Yiyang / Lyy-iiis, PR #4710, built on lee-phys's PR #4688 and Jacob Alan Sussman's PR #4628. The new interface preserves an arbitrary independent second input instead of assuming a zero target. + +## Two-call all-input theorem + +For each positive width f, let A = C0_f and L = P_f + 2 Q_f, with each individual base letter separately tensorized. Starting from arbitrary independent arrays (x,y), compute t = A x, add P_f t + 2 Q_f t to y, and apply A to the second array. The exact output is + + (A x, A y + A L A x). + +There are exactly two charged rank-one calls. In block notation U = [[A,0],[A L A,A]]. Its inverse is [[A^-1,0],[-L,A^-1]]. Both block multiplication orders give the identity. Each inverse Gaussian is one forward call followed by its literal translation, because Cj^-1 = Xj Cj. The reverse program therefore uses two calls. There is no target-zero assumption and no unreturned independent input copy. + +A is unitary and norm(L) <= 3. Factoring U into two unitary block-diagonal maps and [[I,0],[L,I]] proves norm(U) <= 4 and norm(U^-1) <= 4, uniformly in f. The condition number bound 16 applies to the complete two-output map. This proof is valid for arbitrary complex input arrays, not just a tested subspace. + +## Three-call full-input triangular interface + +Let D = J_f W_f A, where J contains one charged C2 call. Applying J_f W_f to the second output produces + + (A x, D y + (M_f C2_f + 2 K_f a_f) x). + +The two predecessor word identities identify the two summands separately. Since the off-diagonal block equals D L A, the inverse is exactly [[A^-1,0],[-L,D^-1]], with three calls. D is unitary, so the same norm and inverse-norm bounds 4 hold. The term D y must remain in the statement; omitting it is false for arbitrary y. It is not an additional productive full Gaussian output. + +All scalar coefficients 2 and -1 remain outside tensor powers. In particular, the bottom-left inverse block is the width-level negative -L, not the tensor power of a base matrix -L. Replacing a base Pauli by a projectively equal representative also changes even-width behavior and is disallowed without accounting for its phase. + +The source also supplies a free algebraic inverse for L. With R = P_f^-1 Q_f and R^4 = I, multiplication of the geometric polynomial proves L^-1 = -(I - 2 R + 4 R^2 - 8 R^3) P_f^-1 / 15. Since these four monomial terms have total absolute coefficient (1 + 2 + 4 + 8) / 15 = 1, the inverse infinity norm is at most 1, uniformly in f. This is a useful precision guarantee. Exact division by the odd denominator 15 is not exact dyadic-grid arithmetic; numerical use must explicitly charge its precision, rounding and native instruction implementation. The two-call and three-call forward/reverse schedules above do not need this coupling inverse. + +## Three-call sector completion + +For T exchanging bits 0 and 2 and epsilon in {+1,-1}, assume T_f x = epsilon x. Then C2_f x = epsilon T_f A x. The explicit residual subtraction, division by 2 and output Pauli correction therefore recover K_f x from the three-call clean-prefix program. The output correction must be the tensor power of the actual phase-bearing B = K a K^-1 = -Z0 Y1. This includes the parity-dependent central sign and is correct at even widths. + +The sector theorem is sufficient on the specified input subspace. It does not produce a complete full-input solver by discarding the complementary projection. Its permitted final scratch clear is a charged singular operation; the reversible full-input norm theorem does not claim that this erasing map has an inverse. + +## Native cost and numerical contract + +The documents charge each free monomial, mixed update and workspace initialization or restoration as an O(N) array pass, N = 8^f. This is necessary: a complete field is not a native word. Their address odometer has amortized constant work per address, with O(N) explicitly owned address workspace or an explicitly owned scatter field. The Gaussian implementations' internal guard and time remain separately charged. + +The stated error budget is conservative and valid under its explicit accuracy contract. With L0 = 2^(f/2), three-call forward error is at most 10 L0^3 rho after input quantization and call errors; rho = 2^(-(P + 2 f + 6)) is sufficient for coordinate error below 2^-P. This assumes the displayed free integer additions and phase changes are exact on the allocated grid, or that any additional rounding is included in the budget. The stated P + H + 4 f + 12 coordinate bits cover the displayed program for nonnegative H and P. This is not a fresh implementation of the charged Gaussian calls. + +## Independent evidence + +verify_word_review.py authenticates the frozen PR #4710 residual engine with SHA-256 0d277854396e4ceda1e0f26916bd576b6decb474c0692b6671ebf2595283ddb9. It independently executes the actual two-register vector schedule at widths 1 and 2, using exact Gaussian rational coordinates. It passes 60 identities, including both sector signs, dirty-target inverses and phase-correct canonical outputs, and 12 controls showing that the dirty baseline is retained. It does not tensor a sum or discard the second input. Run: + + python -I -O -B verify_word_review.py . + +The universal proof is the literal block multiplication and separately tensorized predecessor word identities above; finite tests are corroboration. This is independent computational review by another Codex worker, not independent human review or a kernel formalization. No completed supplier, paid-profile improvement or new kappa is established by this leaf. diff --git a/research/complex-prefix-native-ports/finite_geometry.py b/research/complex-prefix-native-ports/finite_geometry.py new file mode 100644 index 0000000000..ccaa031787 --- /dev/null +++ b/research/complex-prefix-native-ports/finite_geometry.py @@ -0,0 +1,64 @@ +from itertools import product +import json + + +def lin(cols,v): + s=0 + for i,c in enumerate(cols): + if v>>i&1:s^=c + return s + + +def rank(vs): + piv={} + for v in vs: + while v: + k=v.bit_length()-1 + if k in piv:v^=piv[k] + else:piv[k]=v;break + return len(piv) + + +def space(vs):return tuple(sorted({lin(vs,k) for k in range(1<>i)&1)<>i)&1)<>z&1:q[i]^=1<>3 + return lin(a,x)|(lin(it,z^lin(q,x))<<3) + cols=tuple(h(1<>k)&1)*((x>>i)&1)*((x>>j)&1) + return out + quad={sum(ev(m,x)<<(x-1) for x in range(1,8)) for m in range(64)} + qorb=[];remaining=set(quad) + while remaining: + v=next(iter(remaining));orb={sum(((v>>(lin(a,x)-1))&1)<<(x-1) for x in range(1,8)) for a in gl} + if not orb<=quad:raise ValueError('quadratic function space not closed') + remaining-=orb;qorb.append(len(orb)) + if (len(gl),len(hs),len(neighbors),len(stab),sorted(orbits),sorted(qorb)) != (168,10752,14,768,[1,1,12],[1,7,7,21,28]):raise ValueError('geometry mismatch') + print(json.dumps({'status':'PASS_COMPLEX_THREE_AXIS_FINITE_GEOMETRY','GL3_order':len(gl),'H_symplectic_order':len(hs),'rank_one_neighbor_count':len(neighbors),'common_stabilizer_order':len(stab),'stabilizer_neighbor_orbits':sorted(orbits),'quadratic_dual_character_orbits':sorted(qorb),'new_kappa':False},sort_keys=True)) + +if __name__=='__main__':main() diff --git a/research/complex-prefix-native-ports/pr4688/README.md b/research/complex-prefix-native-ports/pr4688/README.md new file mode 100644 index 0000000000..ac33ab3628 --- /dev/null +++ b/research/complex-prefix-native-ports/pr4688/README.md @@ -0,0 +1,257 @@ +# An invertible two-call prefix attaining eight block-3 hook bounds + +**Result.** Two calls on one input can each gain the full 80 in eight +width-five coordinate certificates, using one zero scratch register and a +sum of two free address permutations between the calls. The scratch can be +cleared, and the resulting operator is invertible at **every** positive digit +width. Each of the two summands used alone gives a second gain of only 72. + +This is a scoped mathematical construction and an exact computational proof +of its ranks. It makes the single-free-image obstruction in Jacob Sussman's +[#4628](https://github.com/CrocSwap/integer-mult-bounds/pull/4628) sharp with +respect to allowing two images, in this explicit example. It does **not** +construct five transforms in fourteen calls, improve the call lower bound, +or supply a new multiplication exponent. No Lean or human review is claimed. + +## 1. Was the proposed small-unit problem already solved? + +At the research checkpoint of 22 October 2026, canonical main was +`b58ad9ef4d4e861b0eaa5dba41742bdc072dca51`. PR #4628 remained open at +`ee4fd87f064017c23e5a86fc1dcfe0a5237caed3`; its source repository still had +head `86e575e28ed94890872dcff1bb2621d7ff559cbd`. Both list block 3, +five arrays in fourteen calls, as open in the engine game. The subsequent +[#4643](https://github.com/CrocSwap/integer-mult-bounds/pull/4643) audits the +projection bound at blocks at least 4; it does not settle this case. + +The overlap helper refreshed all pages of 445 open PR bodies and 3,589 +discussion records (snapshot times 15:29 and 15:31 UTC). Targeted PR search +also included closed results. No resolution or competing claim for this +prefix question was found. The sparse checkout searched only 36 of 5,860 +tracked package-note paths; neither this search nor the predecessor's open +label proves global novelty. Exact source links are in section 6. + +## 2. Model and explicit program + +Addresses are triples $x=(x_0,x_1,x_2)\in\mathbb F_2^3$, encoded as +$x_0+2x_1+4x_2$. Let $\mathcal V=\mathbb C^8$. A paid call is + +$$ +C=C_{e_0}=aI+bX_{e_0},\qquad +a=(1+i)/2,\quad b=(1-i)/2, +$$ + +where $X_v e_x=e_{x+v}$. At digit width $f$, write +$C_f=C^{\otimes f}$. The engine permits free invertible binary address +maps on an array, applied identically in each column, and rational linear +mixing of registers, including copies and erasures. + +Use just these two address permutations: + +$$ +Ue_{(x_0,x_1,x_2)}=e_{(x_0,x_1,x_2+x_0)},\qquad +Ve_{(x_0,x_1,x_2)}=e_{(x_1,x_0,x_2)}. +$$ + +In address order $0,\ldots,7$, their images are respectively +`[0,5,2,7,4,1,6,3]` and `[0,2,1,3,4,6,5,7]`. +Write $U_f=U^{\otimes f}$, $V_f=V^{\otimes f}$. +The prefix returns + +$$ +F_{2,f}y=C_f(U_f+2V_f)C_fy. \tag{1} +$$ + +An actual two-register implementation, starting from $(r_0,r_1)=(y,0)$, is: + +1. $r_0\leftarrow C_f r_0$. **One paid call.** +2. $r_1\leftarrow r_0$; $r_1\leftarrow U_f r_1$. +3. $r_0\leftarrow V_f r_0$; $r_1\leftarrow r_1+2r_0$. +4. $r_0\leftarrow V_f r_0$, restoring $u=C_fy$, since $V^2=I$. +5. $r_1\leftarrow C_f r_1$. **One paid call.** The state is $(u,F_{2,f}y)$. +6. Apply the free mixing matrix $\left(\begin{smallmatrix}0&1\\0&0\end{smallmatrix}\right)$, + returning $(F_{2,f}y,0)$. + +This uses two rank-one calls, one initially zero scratch register, integer +mixing coefficients, and no phase letters. No input copy outside these two +registers is assumed. In particular, the sum in (1) is implemented by mixing; +it is **not** $(U+2V)^{\otimes f}$. + +## 3. Invertibility at every width + +Both $U$ and $V$ are involutions. Put $R=U^{-1}V=UV$. +As an address permutation, + +$$ +R=(0)(4)(1\ 2\ 5\ 6)(3\ 7),\qquad R^4=I. +$$ + +Consequently $R_f=R^{\otimes f}$ also satisfies $R_f^4=I$, and + +$$ +(I+2R_f)(I-2R_f+4R_f^2-8R_f^3)=-15I. +$$ + +Since $U_f+2V_f=U_f(I+2R_f)$, this supplies an explicit inverse using +fixed rational coefficients, for every $f$. The two factors $C_f$ are +invertible as well. Thus (1) is invertible at every width, and clearing +$u$ in step 6 loses no input information. This is an analytic all-width +proof; it does not infer uniform correctness from the width-five experiment. + +## 4. Exact simultaneous equality in eight cuts + +At width five restrict to the invariant subspace +$H=\mathcal V\otimes\Lambda^4\mathcal V$, of dimension $8\binom84=560$. +For a single-column matrix $g$, its action is +$\rho(g)=g\otimes\Lambda^4g$, with entries + +$$ +\rho(g)_{(y,S),(x,T)}=g_{yx}\det(g_{S,T}). \tag{2} +$$ + +Split the coordinate basis $e_x\otimes e_T$ into four classes: + +| Class | Condition | Size | +|---|---|---:| +| $O_0$ | $x\in T$, $\bigoplus_{t\in T}t=0$ | 56 | +| $O_1$ | $x\in T$, $\bigoplus_{t\in T}t\ne0$ | 224 | +| $O_2$ | $x\notin T$, $\bigoplus_{t\in T}t=0$ | 56 | +| $O_3$ | $x\notin T$, $\bigoplus_{t\in T}t\ne0$ | 224 | + +The zero-XOR four-subsets are affine planes. For a mask $b$, let $N_b$ +span the classes selected by its four binary digits. Every affine address +map preserves membership and zero XOR (four copies of a translation cancel). +Every diagonal phase preserves each coordinate line. Hence every $N_b$ +below is kept by the engine's free letters. In particular $N_3$ is the +usual hook, and $N_8$ is the published single-term certificate $O_c$. + +Let $q_b:H\to H/N_b$. For a state with one input and output maps +$A_1,\ldots,A_r$, its potential is + +$$ +\Phi_b(A_1,\ldots,A_r) +=\operatorname{rank}\begin{bmatrix} +q_bA_1|_{N_b}\\ \vdots\\ q_bA_r|_{N_b} +\end{bmatrix}. +$$ + +Put $D=\rho(C)$, $A=D\rho(U)D$, $B=D\rho(V)D$, and +$K=\rho(C_{e_2}C_{e_1}C_{e_0})$. Here $A+2B$ is the restriction +of the actual output family (1) to $H$; no tensor lift of a sum is taken. +The complete exact calculation is: + +| Mask $b$ | $\dim N_b$ | $\Phi_b(D)$ | $\Phi_b(D,A)$ | $\Phi_b(D,B)$ | $\Phi_b(D,A+2B)$ | $\Phi_b(A+2B)$ | $\Phi_b(K)$ | +|---:|---:|---:|---:|---:|---:|---:|---:| +| 2 | 224 | 80 | 152 | 152 | 160 | 160 | 224 | +| 3 | 280 | 80 | 152 | 152 | 160 | 160 | 224 | +| 6 | 280 | 80 | 152 | 152 | 160 | 160 | 224 | +| 7 | 336 | 80 | 152 | 152 | 160 | 160 | 224 | +| 8 | 224 | 80 | 152 | 152 | 160 | 160 | 224 | +| 9 | 280 | 80 | 152 | 152 | 160 | 160 | 224 | +| 12 | 280 | 80 | 152 | 152 | 160 | 160 | 224 | +| 13 | 336 | 80 | 152 | 152 | 160 | 160 | 224 | + +The rank 80 is the cap for **every** direction: a binary invertible address +map sends $e_0$ to any nonzero direction and preserves $N_b$. +The kept-subspace argument of #4628 therefore bounds the increase from one +call by 80, even with scratch and singular mixing. These caps and demands +reproduce the known bound $80s\ge224W$, or $s\ge14W/5$. +They are calibration results, not new lower bounds. + +For our prefix the first increase is 80 and the second is +$160-80=80$, simultaneously for every listed cut. The free steps in +between retain $u$ up to an invertible free image and hence preserve its +potential. The joint-state and final-state columns show that the erasure also +preserves all eight potentials. With either branch alone the second +increase is only $152-80=72$. + +**What is new.** A second call can be fully productive on all these cuts +without receiving a fresh independent input: two free images of the same +earlier output suffice, and the combined map can remain uniformly invertible. +Thus the published obstruction for a *single* free image cannot be used as +a pruning rule for arbitrary free linear combinations of that output. +This does not dispute the predecessor's deliberately narrower statement. + +## 5. A singular control that the eight cuts do not distinguish + +Replacing coefficient 2 by 1 gives $F_{1,f}=C_f(U_f+V_f)C_f$. +The checker also obtains $\Phi_b(F_{1,5}|_H)=160$ for every listed cut. +Nevertheless this family is singular. Indeed its nullity is the multiplicity +of eigenvalue $-1$ in $R_f$. The projection onto that eigenspace is +$(I-R_f+R_f^2-R_f^3)/4$. Since the numbers of fixed addresses of +$R^0,R^1,R^2,R^3$ are $8,2,4,2$, tensor traces give exactly + +$$ +\dim\ker F_{1,f}=\frac{8^f+4^f-2\cdot2^f}{4}>0\quad(f\ge1). +$$ + +It is 2 at width one and 8,432 at width five. Erasing the retained first +output in this variant therefore destroys information while preserving all +eight potentials. This is a concrete check that equality in these +certificates does not itself certify injectivity or completion. Coefficient +2 avoids this defect by the explicit inverse in section 3. + +## 6. Reproduction, status, and credit + +```sh +python3.12 -B research/complex-two-image-hook-prefix/verify.py +python3.12 -O -B research/complex-two-image-hook-prefix/verify.py +python3.12 -B scripts/research_package.py --package research/complex-two-image-hook-prefix +``` + +The verifier uses the standard library and computes ranks exactly over +$\mathbb Q(i)$, with Gaussian-integer elimination and exact common-divisor +removal. The ranks over $\mathbb C$ are the same. It replaces $C$ by +$I-iX_{e_0}$, removing a nonzero scalar: each affected block of a rank +matrix is rescaled uniformly, so no rank changes. It expands exterior +products directly, checks all 313,600 entries of the first call against the +independent minor formula (2), and checks its square against +$\rho(I-iX)^2=-32i\rho(X)$. + +Seven controls cover deletion of either summand, duplication of a summand, +replacement of the second permutation by the identity, an incorrect cap of +79, the wrong tensor lift of a sum, and the singular coefficient-1 variant. +Independent cycle enumeration at widths 1, 2, 3 checks the nullity formula. +Exploration used NumPy/modular ranks; **none of those exploratory calculations +or external libraries is an input to the registered proof computation**. +No Lean build, all-history replay, or full integer-multiplication verification +is claimed or needed for this scope. + +`SOURCES.json` pins the originating catalogue and selected record in this +branch's base history. The pending predecessor's exact URLs and document +hashes are bibliographic references in this note and `TASK.json`; replay +does not require fetching an unrelated PR's Git objects. + +Predecessor credit: + +- Jacob Sussman, [#4628 README](https://github.com/jacobalansussman/integer-mult-bounds/blob/ee4fd87f064017c23e5a86fc1dcfe0a5237caed3/research/complex-small-m-lower-bounds/README.md) + and [PROOF.md](https://github.com/jacobalansussman/integer-mult-bounds/blob/ee4fd87f064017c23e5a86fc1dcfe0a5237caed3/research/complex-small-m-lower-bounds/PROOF.md): + model, kept-subspace argument, 14/5 bound, and open shapes. +- Sussman's [single-term gain package](https://github.com/jacobalansussman/wht-power-saving-lean/tree/86e575e28ed94890872dcff1bb2621d7ff559cbd/research/block-bounds-and-new-rules/programs/five-in-fourteen-block3) + and [block-bounds README, section 3.5](https://github.com/jacobalansussman/wht-power-saving-lean/blob/86e575e28ed94890872dcff1bb2621d7ff559cbd/research/block-bounds-and-new-rules/README.md): + the single-image cap 72, eight tight-certificate context, and the warning + that a width-five candidate can fail at width six. This package independently + derives and checks its explicit example; it does not import those programs + or recheck the predecessor's classification of every single-image class. +- eumemic's [#288](https://github.com/CrocSwap/integer-mult-bounds/pull/288) + for the underlying certificate method; Swapnil Jain's P1/P2 as credited by + #4628; OpenAI for the engine's call and free-operation model. + +Prepared for lee-phys with substantial OpenAI Codex assistance in the +derivation, search, code, and writing. No independent human review. +Apache-2.0. No predecessor package or selected-result record is modified. + +## Open next questions + +1. **Can a full 5-in-14 program use this prefix?** It may start with two + saturated calls on one input, but the remaining schedule must deliver all + five independent targets at every width. First test the prefix's allowed + continuations against the per-array end conditions at width six; do not + accept a candidate from this rank table alone. No continuation is supplied. +2. **Which additional invariant distinguishes the singular and invertible + variants while retaining useful call bounds?** Their eight potentials + agree despite different kernels. Start from the explicit order-four + eigenspace in section 5 and track where that information resides under + shared-register mixing. A global lower bound requires a new argument. + +The structured questions and the explicit change from the task card's +selected-supplier scope are recorded in `TASK.json`. diff --git a/research/complex-prefix-native-ports/pr4710/README.md b/research/complex-prefix-native-ports/pr4710/README.md new file mode 100644 index 0000000000..ef39626e0b --- /dev/null +++ b/research/complex-prefix-native-ports/pr4710/README.md @@ -0,0 +1,152 @@ +# A target-compatible phase repair of the two-image block-3 prefix + +This package gives a necessary-condition obstruction for one proposed beginning of a five-array, fourteen-call unit, and an explicit phase repair that removes that obstruction. It does **not** give a completed unit or a new multiplication exponent. + +The starting construction is [lee-phys's PR #4688](https://github.com/CrocSwap/integer-mult-bounds/pull/4688), frozen at `264c4b3cb13c82d171de352ecf60486dfb8d2bd4`. That work proves that its two-call prefix is invertible at every digit width and gains the full 80 per call in eight block-3 hook cuts. We retain its exact rank engine unchanged, with its complete calibration and controls. Jacob Sussman's [PR #4628](https://github.com/CrocSwap/integer-mult-bounds/pull/4628), head `ee4fd87f064017c23e5a86fc1dcfe0a5237caed3`, supplies the engine model and hook lower bound. Neither predecessor claimed that hook equality itself guaranteed a completion. + +## The missing target-alignment condition + +Let `𝓥=C^8`, with addresses `x=x0+2*x1+4*x2`. Write + +- `C_j = ((1+i)/2) I + ((1-i)/2) X_j`, where `X_j` flips bit `j`; +- `C=C_0` and `K=C_2 C_1 C_0`; +- `U`: CNOT from bit 0 to bit 2; +- `V`: swap bits 0 and 1. + +Every letter acts by its tensor power at digit width `f`; a sum is implemented by mixing registers **after** the individual tensor powers. + +At width five, use `H=𝓥 tensor exterior^4(𝓥)`, of dimension 560, and the eight coordinate subspaces `N_b` of #4688. If `q_b:H->H/N_b`, the target has rank 224 and any one paid rank-one call adds at most 80 quotient rows. The two prefixes are + +``` +F_old,f = C_f (U_f + 2 V_f) C_f, +F_new,f = C_f (P_f + 2 Q_f) C_f, +S e_x = i^popcount(x) e_x, +P = S U S, +Q = S V S. +``` + +All factors in `P,Q` are admitted free letters. `S` is the product of the three one-coordinate S phases. Both prefixes use exactly two paid rank-one calls and one zero scratch register, with the same copy/mix/erase schedule as #4688 (replace its `U,V` branches by `P,Q`, and restore the retained first output using `Q^{-1}`). The second prefix contains genuine phase letters, not just Pauli signs. + +The exact ranks are: + +| Cuts `b` | `rank(q F_old)` | `rank([q K; q F_old])` | `rank(q F_new)` | `rank([q K; q F_new])` | +|---|---:|---:|---:|---:| +| 3, 6, 7 | 160 | **280** | 160 | **224** | +| 2, 8, 9, 12, 13 | 160 | 224 | 160 | 224 | + +All restrictions have domain `N_b`. These are ranks over `Q(i)`, calculated by exact Gaussian integer elimination. As in the predecessor, the implementation replaces each `C` by `I-iX` to remove a nonzero scalar. The two branches have equal paid-word length, so their common scalar cancels consistently in every pencil; independent nonzero scaling of target rows also preserves every joint rank. The second column of joint ranks is the extra test; measuring only the rank of the prefix does not detect the first prefix's misalignment. + +### Why the original literal beginning needs at least fifteen calls + +Fix the target rowspace `T` on all five independent inputs, and let `E` be the rowspace of the current stacked quotient observations. Define the remaining target deficit + +``` +d_T(E) = dim(T+E) - dim(E). +``` + +A free operation sends `E` into a subspace of itself, so it cannot decrease this deficit. For a paid call, retain the previous quotient rows conceptually: modulo those rows, at most `rank(q C|N)=80` new independent rows can appear. Consequently a paid call decreases `d_T` by at most 80. This argument permits arbitrary scratch, singular mixing and erasure. + +Suppose the **first two paid calls** are exactly the original #4688 prefix on one fresh independent input, and the other four inputs have not received paid work. For cut 3, the current rowspace has rank 160 and its union with the five target rowspaces has rank `280+4*224=1176`. Thus the deficit is **1016**, exceeding the capacity `12*80=960` of the twelve remaining calls. At least thirteen further calls are needed, for at least fifteen total. Keeping the first output `C_f y` does not help: #4688 already certifies `rank([q C; q F_old])=rank(q F_old)=160`. + +The same calculation for `W` fresh inputs gives the total lower bound `ceil((224*W+56)/80)` for this literal beginning. For example, six inputs would need at least eighteen calls, so it cannot begin a six-in-seventeen unit either. + +This is not an obstruction to an arbitrarily pre-encoded or later occurrence of the same word, nor a lower bound excluding five in fourteen generally. It is a statement about this literal two-call beginning on one fresh input. The original prefix's invertibility and full local gains remain valid. + +For the repaired prefix, the corresponding deficit is `64+4*224=960`. It passes this necessary test exactly. This equality does not supply a continuation. + +## An exact all-width inverse + +Both `U,V` are involutions. The relative monomial is + +``` +R=P^{-1}Q = S^{-1} U^{-1} V S, +R^4=I, +(I+2R)(I-2R+4R^2-8R^3)=-15I. +``` + +The same identity holds for `R_f=R^{tensor f}` at every positive `f`. Since `P_f+2Q_f=P_f(I+2R_f)`, the free middle operator is invertible with a fixed rational inverse. The two outside calls are invertible too. Thus clearing the retained first output loses no input information. No inverse has to be executed by the forward prefix. + +There is also no width-dependent conditioning loss: all outside factors are unitary and the eigenvalues of `R_f` are fourth roots of unity. The singular values of the prefix therefore belong to `{1,sqrt(5),3}`, with both extremes present for every positive width. Its Euclidean condition number is exactly 3. The original prefix has this same property; it is not a unique benefit of the repair and is not a full outer precision theorem. + +## The natural higher-width hook tests also pass + +The result is stronger than a width-five numerical coincidence. Put + +``` +A=C P C, B=C Q C, +A5=rho(A), B5=rho(B), K5=rho(K), +rho(g)=g tensor exterior^4(g). +``` + +The checker proves, separately for each of the eight cuts: + +1. `rank([q K5; q A5])=rank([q K5; q B5])=224`. Equivalently, each branch separately annihilates `ker(q K5)` after applying `q`. +2. All four pencil matrices `q(A5+2 lambda B5)|N`, for `lambda=1,-1,i,-i`, have rank **160**. + +For `r` additional digit columns, use the invariant space `H tensor 𝓥^{tensor r}` and the kept subspace `N_b tensor 𝓥^{tensor r}`. The relative single-column matrix `A^{-1}B=C^{-1}RC` has fourth power one and eigenvalue multiplicities `4,2,1,1`. Multiplying by an invertible matrix in the additional columns reduces the quotient prefix to the direct sum of the four pencil evaluations, with the multiplicities of `(A^{-1}B)^{tensor r}`. Its rank is therefore exactly + +``` +160 * 8^r. +``` + +The branchwise kernel inclusions tensor with the additional columns, so the joint target-prefix rank is exactly `224*8^r`. This proves zero alignment defect and two maximal call gains for **all these lifted cuts**, at every `r>=0`. In particular the width-six ranks are 1280 for the prefix and 1792 for the target and joint state. + +This does not claim that every possible higher-width certificate passes, that all output end conditions hold, or that a multi-input completion exists. + +## A concrete residual interface for further work + +The repaired prefix also has an explicit all-width relation to the target. With Hermitian Paulis `Y_j=i X_j Z_j`, put + +``` +a=Y0 Z1, W=Z0 Z2, J=Z1 V C2, +M=X1 V CNOT(2->0) Z1 S2 CZ02. +``` + +`J` uses one paid call and `M` is entirely free. The independent standard-library checker `verify_residual.py` multiplies actual 8-by-8 matrices over Gaussian rationals and verifies the two **word** identities + +``` +J W C0 P C0 = M C2, +J W C0 Q C0 = K a. +``` + +Tensorize these identities separately and then add the second with coefficient 2. For every positive digit width, + +``` +J_f W_f F_new,f = M_f C2_f + 2 K_f a_f. +``` + +Thus the remaining contamination is exactly a free image of one paid call, rather than an unspecified operator. This gives a precise cross-input cancellation problem. The formula itself is not a saving: directly computing both terms is insufficient to deliver five independent targets in fourteen calls. + +The same checker verifies four actual free projector sectors, generated on input by the commuting Hermitian Paulis `a=Y0 Z1` and `b=Y2`. At width `f`, set `e(alpha,beta)=(I+alpha*a_f)(I+beta*b_f)/4`. The prefix transports this projector to `e(epsilon*alpha,epsilon*beta)`, where `epsilon=(-1)^f`. These projectors can pack pieces of distinct independent inputs and separate them after the two-call prefix, but the other pieces must also be preserved and eventually processed. This is a feasible interface, not a complete unit. + +## Reproduction + +Only the Python standard library is required. No network, solver, floating point rank, or source checkout is used. + +```sh +python3 -B verify.py --check RESULT.json +python3 -O -B verify.py --check RESULT.json +``` + +The checker authenticates the unchanged #4688 engine and README, runs that predecessor's complete calibration and seven controls, computes the new Gaussian ranks, verifies the four-point pencils and the actual monomial inverse, and checks the exact deficit arithmetic. It also invokes the independent Gaussian-rational residual checker, including its wrong-phase and wrong-coefficient controls. Regenerate the deterministic report with `python3 -B verify.py --out RESULT.json`. + +The frozen predecessor engine is retained under `vendor/pr4688`; its provenance and hashes are in `PINNED-SOURCES.json` and `NOTICE.md`. No Lean proof or human review is claimed. + +The registered repository replay is: + +```sh +python3 scripts/research_package.py --package research/phase-aligned-two-call-prefix +``` + +## Open next questions + +1. Complete the repaired prefix to five independent transforms in fourteen calls. Start with the explicit residual identity and the four Pauli sectors, preserving every complementary input piece and restored scratch. A literal all-width continuation and its complete paid bill remain missing. +2. Test other width-six invariant subspaces and output end conditions. The proof above covers every natural `H tensor V^r` hook lift; it does not cover every invariant of the engine game. + +The structured questions, scope change and current-priority provenance are recorded in `TASK.json`. The selected frontier is unchanged. + +## Attribution and review scope + +Prepared by Yiyang (@Lyy-iiis), with substantial OpenAI Codex assistance in parallel research, implementation and independent agent review. New work is Apache-2.0. Credit lee-phys's #4688 for the original two-image construction, rank engine and controls; Jacob Sussman's #4628 and its retained sources for the model and lower bound; and the predecessors credited in the unchanged source README. The new result is the target-deficit analysis, explicit phase repair, lifted-hook proof and residual interface. No independent human review or full multiplication-theorem verification is claimed. + +`SOURCES.json` authenticates the vendored files through their first preservation commit on this branch; their Git blob IDs are also checked equal to the files at the original #4688 head. The original commit, paths and SHA256 hashes are recorded separately in `PINNED-SOURCES.json`. No predecessor branch is merged or modified. diff --git a/research/complex-prefix-native-ports/pr4710/verify_residual.py b/research/complex-prefix-native-ports/pr4710/verify_residual.py new file mode 100644 index 0000000000..9130ce2171 --- /dev/null +++ b/research/complex-prefix-native-ports/pr4710/verify_residual.py @@ -0,0 +1,233 @@ +#!/usr/bin/env python3 +"""Exact residual and projector transport for the repaired two-call prefix. + +This verifier uses only the Python standard library. Entries are pairs of +fractions representing Gaussian rationals; no floating point or source checker +is used. Matrix words act right-to-left on e_x, x=x0+2*x1+4*x2. + +Provenance: C, U=CNOT(0->2), V=SWAP(0,1), and the original two-image prefix +are from CrocSwap/integer-mult-bounds PR #4688, exact head +264c4b3cb13c82d171de352ecf60486dfb8d2bd4, package +research/complex-two-image-hook-prefix. The repair P=S_all U S_all, +Q=S_all V S_all, and the residual identity below are this contribution. + +For EACH base letter A let A_f=A tensor ... tensor A (f factors). Define +F_f=C0_f (P_f+2 Q_f) C0_f. In particular F_f is NOT F_1 tensor ... tensor F_1. +We verify the two distinct word equalities + J W C0 P C0 = M C2, J W C0 Q C0 = K a. +Tensor functoriality applies separately to these two products. Linearity then +gives, for every positive integer f, with the SAME coefficient 2, + J_f W_f F_f = M_f C2_f + 2 K_f a_f. +This is an exact target-plus-one-call residual identity, not a 5-in-14 program. + +All scalar phases are attached to base letters before tensorization. Thus +(-A)_f=(-1)^f A_f. The projector sign map below retains this parity explicitly. +""" + +from __future__ import annotations + +import argparse +from fractions import Fraction as F +import json +from pathlib import Path + + +def q(real=0, imag=0): + return (F(real), F(imag)) + + +ZERO, ONE, I = q(), q(1), q(0, 1) +I_POWERS = (ONE, I, q(-1), q(0, -1)) + + +def add(x, y): + return (x[0] + y[0], x[1] + y[1]) + + +def mul(x, y): + return (x[0] * y[0] - x[1] * y[1], x[0] * y[1] + x[1] * y[0]) + + +def scale(c, a): + return tuple(tuple(mul(c, v) for v in row) for row in a) + + +def plus(a, b): + return tuple(tuple(add(x, y) for x, y in zip(ar, br)) for ar, br in zip(a, b)) + + +def mm(a, b): + n = len(a) + out = [[ZERO for _ in range(n)] for _ in range(n)] + for r in range(n): + for k in range(n): + if a[r][k] == ZERO: + continue + for c in range(n): + if b[k][c] != ZERO: + out[r][c] = add(out[r][c], mul(a[r][k], b[k][c])) + return tuple(tuple(row) for row in out) + + +def word(*letters): + out = ident(len(letters[0])) + for letter in letters: + out = mm(out, letter) + return out + + +def ident(n=8): + return tuple(tuple(ONE if r == c else ZERO for c in range(n)) for r in range(n)) + + +def adjoint(a): + return tuple(tuple((a[c][r][0], -a[c][r][1]) for c in range(len(a))) for r in range(len(a))) + + +def monomial(permutation, phases=None): + if phases is None: + phases = [0] * len(permutation) + n = len(permutation) + require(sorted(permutation) == list(range(n)), "invalid monomial permutation") + return tuple(tuple(I_POWERS[phases[c] % 4] if r == permutation[c] else ZERO for c in range(n)) for r in range(n)) + + +def pauli(x, z): + """Hermitian convention i^popcount(x&z) X^x Z^z, not bare X^x Z^z.""" + return monomial([j ^ x for j in range(8)], [(x & z).bit_count() + 2 * (j & z).bit_count() for j in range(8)]) + + +def c_letter(bit): + return plus(scale(q(F(1, 2), F(1, 2)), ident()), scale(q(F(1, 2), F(-1, 2)), pauli(1 << bit, 0))) + + +def s_letter(mask): + """Product of S gates on the selected bits, with phase sum mod4.""" + return monomial(list(range(8)), [(j & mask).bit_count() for j in range(8)]) + + +def conj(a, b): + return word(a, b, adjoint(a)) + + +def describe_pauli(a): + hits = [] + for x in range(8): + for z in range(8): + for exponent in range(4): + if a == scale(I_POWERS[exponent], pauli(x, z)): + hits.append({"label_x_or_8z": x | (8 * z), "phase_i_exponent": exponent}) + require(len(hits) == 1, "ambiguous or missing Hermitian Pauli label: " + str(hits)) + return hits[0] + + +def require(condition, message): + if not condition: + raise AssertionError(message) + + +def verify(): + e = ident() + c0, c1, c2 = (c_letter(j) for j in range(3)) + sall = s_letter(7) + u = monomial([0, 5, 2, 7, 4, 1, 6, 3]) + v = monomial([0, 2, 1, 3, 4, 6, 5, 7]) + p, qword = word(sall, u, sall), word(sall, v, sall) + zall = pauli(0, 7) + require(qword == word(zall, v), "Q=Z_all V") + # Normalize each paid and free base letter independently. + for name, a in (("C0", c0), ("C1", c1), ("C2", c2), ("S_all", sall), ("U", u), ("V", v), ("P", p), ("Q", qword)): + require(word(a, adjoint(a)) == e, name + " unitarity") + for bit, c in enumerate((c0, c1, c2)): + require(word(c, c) == pauli(1 << bit, 0), "C_bit^2=X_bit") + + k = word(c0, c1, c2) + a, b = pauli(1, 3), pauli(4, 4) # a=Y0 Z1, b=Y2. + w = pauli(0, 5) # W=Z0 Z2. + jword = word(pauli(0, 2), v, c2) # J=Z1 V C2: exactly one paid call. + m_perm = [2, 0, 3, 1, 4, 6, 5, 7] + m_phases = [0, 0, 2, 2, 1, 3, 3, 1] + m = monomial(m_perm, m_phases) + u20 = monomial([0, 1, 2, 3, 5, 4, 7, 6]) + cz02 = monomial(list(range(8)), [2 * (x & 1) * ((x >> 2) & 1) for x in range(8)]) + s_parity02 = monomial(list(range(8)), [((x & 5).bit_count() % 2) for x in range(8)]) + require(cz02 == word(s_letter(1), s_letter(4), adjoint(s_parity02)), "CZ uses allowed S of parity") + require(m == word(pauli(2, 0), v, u20, pauli(0, 2), s_letter(4), cz02), "M free-letter factorization") + + branch_p, branch_q = word(c0, p, c0), word(c0, qword, c0) + require(word(jword, w, branch_p) == word(m, c2), "P branch target residual") + require(word(jword, w, branch_q) == word(k, a), "Q branch target term") + prefix = plus(branch_p, scale(q(2), branch_q)) + require(word(jword, w, prefix) == plus(word(m, c2), scale(q(2), word(k, a))), "combined identity") + + middle_a, middle_b = pauli(0, 3), pauli(4, 4) + r = word(adjoint(p), qword) + require(word(r, r, r, r) == e, "R has order dividing4") + require(word(r, r) != e, "R has exact order4") + require(word(r, middle_a) == word(middle_a, r), "R commutes A") + require(word(r, middle_b) == word(middle_b, r), "R commutes B") + require(conj(adjoint(c0), middle_a) == a, "input a label") + require(conj(adjoint(c0), middle_b) == b, "input b label") + out_a, out_b = conj(word(c0, p), middle_a), conj(word(c0, p), middle_b) + require(out_a == scale(q(-1), a) and out_b == scale(q(-1), b), "base output signs") + require(word(prefix, a) == word(out_a, prefix), "prefix a transport") + require(word(prefix, b) == word(out_b, prefix), "prefix b transport") + require(conj(jword, a) == conj(k, a) and conj(jword, b) == conj(k, b), "one-call projector bridge") + lword = word(adjoint(jword), k) + gword = word(w, branch_p) + require(lword == word(v, pauli(0, 2), c0, c1), "residual L factorization") + require(word(lword, lword) == scale(q(-1), a), "L^2=-a at base width") + require(word(gword, gword) == scale(q(-1), e), "G^2=-I at base width") + require(word(w, branch_q) == word(a, lword), "Q branch with W") + for generator in (a, b): + require(word(lword, generator) == word(generator, lword), "L centralizes input sectors") + require(word(w, prefix, generator) == word(generator, w, prefix), "WF centralizes input sectors") + projectors = [] + for alpha in (1, -1): + for beta in (1, -1): + ep = scale(q(F(1, 4)), word(plus(e, scale(q(alpha), a)), plus(e, scale(q(beta), b)))) + ep_out = scale(q(F(1, 4)), word(plus(e, scale(q(-alpha), a)), plus(e, scale(q(-beta), b)))) + require(word(ep, ep) == ep, "projector idempotence") + require(word(prefix, ep) == word(ep_out, prefix), "base sector sign flip") + projectors.append(ep) + require(plus(plus(projectors[0], projectors[1]), plus(projectors[2], projectors[3])) == e, "complete four-sector partition") + for i in range(4): + for j in range(i): + require(word(projectors[i], projectors[j]) == scale(ZERO, e), "orthogonal sectors") + + # Meaningful negative controls: one wrong free phase and one wrong mixer. + wrong_phases = m_phases.copy() + wrong_phases[0] = 1 + require(word(jword, w, branch_p) != word(monomial(m_perm, wrong_phases), c2), "wrong M phase rejected") + require(word(jword, w, prefix) != plus(word(m, c2), word(k, a)), "wrong mixing coefficient rejected") + return { + "status": "PASS", + "arithmetic": "exact Gaussian rationals; Python stdlib Fraction pairs", + "branch_identities": ["J W C0 P C0 = M C2", "J W C0 Q C0 = K a"], + "all_width_identity": "J_f W_f F_f = M_f C2_f + 2 K_f a_f", + "all_width_reason": "Tensorize each branch word separately, then add with coefficient2; never tensorize the sum F_1.", + "M_permutation": m_perm, + "M_phase_i_exponents": m_phases, + "M_free_factorization": "X1 SWAP01 CNOT(2->0) Z1 S2 CZ02", + "input_generators": [describe_pauli(a), describe_pauli(b)], + "output_generators_at_base_width": [describe_pauli(out_a), describe_pauli(out_b)], + "target_generators_at_base_width": [describe_pauli(conj(k, a)), describe_pauli(conj(k, b))], + "all_width_projectors": "e(alpha,beta)=(I+alpha*a_f)(I+beta*b_f)/4; F_f e(alpha,beta)=e(epsilon*alpha,epsilon*beta)F_f, epsilon=(-1)^f", + "negative_controls": ["wrong M phase rejected", "wrong coefficient2 rejected"], + "limitation": "Exact residual and sector transport only; no independent-array 5-in-14 continuation or improved kappa is claimed.", + } + + +def main(): + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument("--out", type=Path, help="Optional JSON receipt path; otherwise print only") + args = parser.parse_args() + result = verify() + data = json.dumps(result, indent=2) + "\n" + if args.out: + args.out.write_text(data) + print(data, end="") + + +if __name__ == "__main__": + main() diff --git a/research/complex-prefix-native-ports/verify.py b/research/complex-prefix-native-ports/verify.py new file mode 100644 index 0000000000..058b220e37 --- /dev/null +++ b/research/complex-prefix-native-ports/verify.py @@ -0,0 +1,31 @@ +#!/usr/bin/env python3 +"""Portable exact replay of the scoped native ports. Apache-2.0.""" +from pathlib import Path +from hashlib import sha256 +import json, subprocess, sys, tempfile +P=Path(__file__).resolve().parent + +def need(ok, text): + if not ok: raise ValueError(text) + +def main(): + manifest=json.loads((P/'MANIFEST.json').read_text(encoding='utf8')) + actual={p.relative_to(P).as_posix() for p in P.rglob('*') if p.is_file() and '__pycache__' not in p.parts and p.name!='MANIFEST.json'} + need(actual==set(manifest),'package inventory mismatch') + for name,h in manifest.items():need(sha256((P/name).read_bytes()).hexdigest()==h,'package source drift: '+name) + for row in json.loads((P/'SOURCE-PINS.json').read_text(encoding='utf8')): + need(sha256((P/row['file']).read_bytes()).hexdigest()==row['sha256'],'predecessor source drift: '+row['file']) + expected=json.loads((P/'CHECKS.json').read_text(encoding='utf8')) + with tempfile.TemporaryDirectory(prefix='complex-prefix-cache-') as cache: + for name,want in expected.items(): + argv=[sys.executable,'-I','-B','-X','pycache_prefix='+cache] + if sys.flags.optimize: argv.append('-O') + argv.append(str(P/name)) + if name=='verify_word_review.py': argv.append(str(P)) + job=subprocess.run(argv,check=True,capture_output=True,text=True,encoding='utf8',timeout=120,cwd=P) + got=json.loads(job.stdout) + need(got==want,'changed mathematical receipt: '+name) + print(got['status']) + print('PASS_COMPLEX_PREFIX_NATIVE_PORTS') + +if __name__=='__main__':main() diff --git a/research/complex-prefix-native-ports/verify_full_input_port.py b/research/complex-prefix-native-ports/verify_full_input_port.py new file mode 100644 index 0000000000..d036eacfec --- /dev/null +++ b/research/complex-prefix-native-ports/verify_full_input_port.py @@ -0,0 +1,57 @@ +"""Exact full-input triangular block checks; standard library only.""" +import hashlib, importlib.util, json +from pathlib import Path + + +def main(): + root = Path(__file__).resolve().parent + pins = json.loads((root / 'SOURCE-PINS.json').read_text(encoding='utf-8')) + src = root / 'pr4710' / 'verify_residual.py' + expected = next(x['sha256'] for x in pins if x['file'] == 'pr4710/verify_residual.py') + if hashlib.sha256(src.read_bytes()).hexdigest() != expected: + raise ValueError('frozen predecessor drift') + spec = importlib.util.spec_from_file_location('residual_full_port', src) + v = importlib.util.module_from_spec(spec) + spec.loader.exec_module(v) + def require(ok, msg): + if not ok: + raise ValueError(msg) + C = [v.c_letter(j) for j in range(3)] + I = v.ident() + Z = v.scale(v.q(0), I) + U = v.monomial([0, 5, 2, 7, 4, 1, 6, 3]) + V = v.monomial([0, 2, 1, 3, 4, 6, 5, 7]) + S = v.s_letter(7) + P, Q = v.word(S, U, S), v.word(S, V, S) + L = v.plus(P, v.scale(v.q(2), Q)) + K, a = v.word(*C), v.pauli(1, 3) + W = v.pauli(0, 5) + J = v.word(v.pauli(0, 2), V, C[2]) + M = v.monomial([2, 0, 3, 1, 4, 6, 5, 7], [0, 0, 2, 2, 1, 3, 3, 1]) + A = C[0] + D = v.word(J, W, C[0]) + B = v.plus(v.word(M, C[2]), v.scale(v.q(2), v.word(K, a))) + require(v.word(J, W, C[0], P, C[0]) == v.word(M, C[2]), 'P branch') + require(v.word(J, W, C[0], Q, C[0]) == v.word(K, a), 'Q branch') + R = v.word(v.adjoint(P), Q) + R2, R3, R4 = v.word(R, R), v.word(R, R, R), v.word(R, R, R, R) + require(R4 == I, 'actual phase relative order four') + Linv = v.scale(v.q(v.F(-1, 15)), v.word(v.plus(v.plus(I, v.scale(v.q(-2), R)), v.plus(v.scale(v.q(4), R2), v.scale(v.q(-8), R3))), v.adjoint(P))) + require(v.word(Linv, L) == I and v.word(L, Linv) == I, 'free coupling inverse') + F = v.word(A, L, A) + Ai = v.adjoint(A) + require(v.word(Ai, F) == v.word(L, A), 'two call inverse left order') + require(v.word(F, Ai) == v.word(A, L), 'two call inverse right order') + require(v.word(D, L, A) == B, 'full input bottom left block') + Ai, Di = v.adjoint(A), v.adjoint(D) + require(v.word(Ai, A) == I and v.word(A, Ai) == I, 'A inverse') + require(v.word(Di, D) == I and v.word(D, Di) == I, 'D inverse') + require(v.plus(v.scale(v.q(-1), v.word(L, A)), v.word(Di, B)) == Z, 'inverse times forward off diagonal') + require(v.plus(v.word(B, Ai), v.scale(v.q(-1), v.word(D, L))) == Z, 'forward times inverse off diagonal') + for j in range(3): + require(v.adjoint(C[j]) == v.word(v.pauli(1 << j, 0), C[j]), 'one paid inverse') + require(D != Z, 'reject erasing arbitrary second input') + print(json.dumps({'status': 'PASS_FULL_INPUT_TRIANGULAR_PORT', 'two_call_port': {'forward_paid_calls': 2, 'inverse_paid_calls': 2}, 'three_call_port': {'forward_paid_calls': 3, 'inverse_paid_calls': 3}, 'arbitrary_independent_input_arrays': 2, 'euclidean_norm_bound': 4, 'inverse_norm_bound': 4, 'new_kappa': False}, sort_keys=True)) + +if __name__ == '__main__': + main() diff --git a/research/complex-prefix-native-ports/verify_native_interface.py b/research/complex-prefix-native-ports/verify_native_interface.py new file mode 100644 index 0000000000..fc69515359 --- /dev/null +++ b/research/complex-prefix-native-ports/verify_native_interface.py @@ -0,0 +1,65 @@ +"""Exact bounded-word address generator and precision-envelope checks.""" +import json + + +def stream(f, perm, phase): + N = 8 ** f + powers = [1 << (3 * j) for j in range(f)] + digits = [0] * f + out = perm[0] * sum(powers) + ph = f * phase[0] % 4 + changed = 0 + rows = [(out, ph)] + for x in range(1, N): + j = 0 + while True: + old = digits[j] + new = (old + 1) & 7 + digits[j] = new + out += (perm[new] - perm[old]) * powers[j] + ph = (ph + phase[new] - phase[old]) & 3 + changed += 1 + if new: + break + j += 1 + rows.append((out, ph)) + return rows, changed + + +def direct(x, f, perm, phase): + out, ph = 0, 0 + for j in range(f): + d = (x >> (3 * j)) & 7 + out += perm[d] << (3 * j) + ph += phase[d] + return out, ph & 3 + + +def main(): + cases = [ + ([0, 2, 1, 3, 4, 6, 5, 7], [0] * 8), + ([0, 5, 2, 7, 4, 1, 6, 3], [x.bit_count() & 3 for x in range(8)]), + ([2, 0, 3, 1, 4, 6, 5, 7], [0, 0, 2, 2, 1, 3, 3, 1]), + ([7 - x for x in range(8)], [3, 1, 2, 0, 1, 0, 3, 2]), + ] + checked, updates = 0, 0 + for f in range(1, 6): + N = 8 ** f + for perm, phase in cases: + rows, count = stream(f, perm, phase) + if not all(got == direct(x, f, perm, phase) for x, got in enumerate(rows)): + raise ValueError('incorrect monomial stream') + if 7 * count >= 8 * N: + raise ValueError('carry budget exceeded') + if len({x for x, _ in rows}) != N: + raise ValueError('address permutation lost') + checked += N + updates += count + # Symbolic bound: L^3 <= 2^(2f), rho = 2^(-(P+2f+6)). + # Thus 10 L^3 rho <= (10/64) 2^(-P), uniformly in f and P. + if not 10 < 64: + raise ValueError('precision envelope') + print(json.dumps({'status': 'PASS_NATIVE_MONOMIAL_STREAM', 'checked_entries': checked, 'digit_updates': updates, 'cases': len(cases), 'widths': [1, 2, 3, 4, 5], 'all_width_update_bound': 'changed_digits < 8N/7', 'precision_error_factor_upper_bound': '10/64'}, sort_keys=True)) + +if __name__ == '__main__': + main() diff --git a/research/complex-prefix-native-ports/verify_sector_completion.py b/research/complex-prefix-native-ports/verify_sector_completion.py new file mode 100644 index 0000000000..a2a229878b --- /dev/null +++ b/research/complex-prefix-native-ports/verify_sector_completion.py @@ -0,0 +1,42 @@ +"""Exact phase-aware checks for an all-width three-call sector completion.""" +import hashlib,importlib.util,json +from pathlib import Path + + +def main(): + root=Path(__file__).resolve().parent + src=root/'pr4710'/'verify_residual.py' + pins=json.loads((root/'SOURCE-PINS.json').read_text(encoding='utf-8')) + expected=next(x['sha256'] for x in pins if x['file']=='pr4710/verify_residual.py') + if hashlib.sha256(src.read_bytes()).hexdigest()!=expected:raise ValueError('frozen residual source drift') + spec=importlib.util.spec_from_file_location('frozen_residual',src);v=importlib.util.module_from_spec(spec);spec.loader.exec_module(v) + I=v.ident(); C=[v.c_letter(i) for i in range(3)] + T=v.monomial([((x&1)<<2)|(x&2)|((x&4)>>2) for x in range(8)]) + U=v.monomial([0,5,2,7,4,1,6,3]); V=v.monomial([0,2,1,3,4,6,5,7]); S=v.s_letter(7) + P=v.word(S,U,S);Q=v.word(S,V,S) + A=v.word(C[0],P,C[0]);B=v.word(C[0],Q,C[0]);F=v.plus(A,v.scale(v.q(2),B)) + K=v.word(*C);a=v.pauli(1,3);W=v.pauli(0,5);J=v.word(v.pauli(0,2),V,C[2]) + M=v.monomial([2,0,3,1,4,6,5,7],[0,0,2,2,1,3,3,1]) + def req(x,label): + if not x:raise ValueError(label) + req(v.word(T,T)==I,'T inverse') + req(v.word(T,C[0],T)==C[2],'actual swap conjugation') + req(v.word(J,W,A)==v.word(M,C[2]),'P word residual') + req(v.word(J,W,B)==v.word(K,a),'Q word target') + out_pauli=v.word(K,a,v.adjoint(K));desc=v.describe_pauli(out_pauli) + req(v.word(v.adjoint(out_pauli),K,a)==K,'free output ABI correction') + rejected=0 + for sign in [1,-1]: + E=v.scale(v.q(1,0),v.plus(I,v.scale(v.q(sign),T))) + E=v.scale(v.q(v.F(1,2)),E) + req(v.word(E,E)==E,'projector idempotence') + req(v.word(C[2],E)==v.scale(v.q(sign),v.word(T,C[0],E)),'sector residual closure') + left=v.plus(v.word(J,W,F,E),v.scale(v.q(-sign),v.word(M,T,C[0],E))) + req(left==v.scale(v.q(2),v.word(K,a,E)),'full completed sector') + got=v.scale(v.q(v.F(1,2)),v.word(v.adjoint(out_pauli),left)) + req(got==v.word(K,E),'canonical target on sector') + bad=v.plus(v.word(J,W,F,E),v.scale(v.q(sign),v.word(M,T,C[0],E))) + req(bad!=v.scale(v.q(2),v.word(K,a,E)),'wrong residual sign control');rejected+=1 + print(json.dumps({'status':'PASS_THREE_CALL_SECTOR_COMPLETION','paid_calls':3,'sectors':[1,-1],'output_abi_pauli':desc,'wrong_sign_rejections':rejected,'proof_scope':'base word identities tensorized separately; scalar coefficients outside tensor powers','new_kappa':False},sort_keys=True)) + +if __name__=='__main__':main() diff --git a/research/complex-prefix-native-ports/verify_word_review.py b/research/complex-prefix-native-ports/verify_word_review.py new file mode 100644 index 0000000000..13b9e32853 --- /dev/null +++ b/research/complex-prefix-native-ports/verify_word_review.py @@ -0,0 +1,69 @@ +"""Independent exact vector replay at widths 1 and 2; no tensor-of-sum shortcut.""" +from pathlib import Path +import hashlib, importlib.util, json, sys + +base=Path(sys.argv[1]) if len(sys.argv)>1 else Path(__file__).resolve().parent.parent/'word' +p=base/'pr4710'/'verify_residual.py' +if hashlib.sha256(p.read_bytes()).hexdigest()!='0d277854396e4ceda1e0f26916bd576b6decb474c0692b6671ebf2595283ddb9': + raise ValueError('source drift') +spec=importlib.util.spec_from_file_location('exact_source',p);v=importlib.util.module_from_spec(spec);spec.loader.exec_module(v) +C=[v.c_letter(j) for j in range(3)];S=v.s_letter(7) +U=v.monomial([0,5,2,7,4,1,6,3]);V=v.monomial([0,2,1,3,4,6,5,7]) +P=v.word(S,U,S);Q=v.word(S,V,S);A=C[0] +J=v.word(v.pauli(0,2),V,C[2]);W=v.pauli(0,5) +M=v.monomial([2,0,3,1,4,6,5,7],[0,0,2,2,1,3,3,1]);K=v.word(*C);a=v.pauli(1,3) +T=v.monomial([((x&1)<<2)|(x&2)|((x&4)>>2) for x in range(8)]) +correction=v.word(K,a,v.adjoint(K)) + +def req(b,s): + if not b: raise ValueError(s) +def plus(x,y,c=1):return [v.add(a,v.mul(v.q(c),b)) for a,b in zip(x,y)] +def scaled(x,c):return [v.mul(v.q(c),a) for a in x] +def tensor_apply(G,x,f): + out=x[:] + for axis in range(f): + stride=8**axis;nxt=out[:] + for start in range(0,len(x),8*stride): + for off in range(stride): + for r in range(8): + z=v.ZERO + for c in range(8):z=v.add(z,v.mul(G[r][c],out[start+off+c*stride])) + nxt[start+off+r*stride]=z + out=nxt + return out + +R=v.word(v.adjoint(P),Q) +R2=v.word(R,R);R3=v.word(R2,R) +req(v.word(R3,R)==v.ident(),'actual phase-bearing coupling order four') +poly=v.plus(v.plus(v.ident(),v.scale(v.q(-2),R)),v.plus(v.scale(v.q(4),R2),v.scale(v.q(-8),R3))) +Li=v.scale(v.q(v.F(-1,15)),v.word(poly,v.adjoint(P))) +L=v.plus(P,v.scale(v.q(2),Q)) +req(v.word(L,Li)==v.ident(),'left coupling inverse') +req(v.word(Li,L)==v.ident(),'right coupling inverse') +tests=0;controls=0 +for f in (1,2): + apply=lambda G,x:tensor_apply(G,x,f) + for seed in range(6): + x=[v.q((13*j+seed)%11-5,(7*j+3*seed)%9-4) for j in range(8**f)] + y=[v.q((5*j+seed)%7-3,(11*j+seed)%13-6) for j in range(8**f)] + t=apply(A,x) + mixed=plus(plus(y,apply(P,t)),apply(Q,t),2) + s=apply(A,mixed) + req(s==plus(apply(A,y),apply(A,plus(apply(P,t),apply(Q,t),2))),'dirty two-call') + recovered=plus(plus(apply(v.adjoint(A),s),apply(P,t),-1),apply(Q,t),-2) + req(recovered==y and apply(v.adjoint(A),t)==x,'two-call inverse') + u=apply(J,apply(W,s)) + rhs=plus(plus(apply(J,apply(W,apply(A,y))),apply(M,apply(C[2],x))),apply(K,apply(a,x)),2) + req(u==rhs,'three-call dirty block') + req(apply(J,apply(W,apply(A,y)))!=[v.ZERO]*len(y),'dirty baseline retained');controls+=1 + for sign in (1,-1): + sector=scaled(plus(x,apply(T,x),sign),v.F(1,2)) + t0=apply(A,sector) + s0=apply(A,plus(apply(P,t0),apply(Q,t0),2)) + u0=apply(J,apply(W,s0)) + clean=scaled(plus(u0,apply(M,apply(T,t0)),-sign),v.F(1,2)) + clean=apply(v.adjoint(correction),clean) + req(clean==apply(K,sector),'sector canonical target including phase') + tests+=1 + tests+=3 +print(json.dumps({'status':'PASS_INDEPENDENT_WORD_REVIEW','widths':[1,2],'exact_vector_identities':tests,'dirty_baseline_controls':controls,'exact_coupling_inverse_checks':3,'all_width_basis':'separate tensorized word products; proof in WORD-REVIEW.md','new_kappa':False},sort_keys=True))