diff --git a/research/central-q-decoder/.gitattributes b/research/central-q-decoder/.gitattributes new file mode 100644 index 0000000000..fa1385d99a --- /dev/null +++ b/research/central-q-decoder/.gitattributes @@ -0,0 +1 @@ +* -text diff --git a/research/central-q-decoder/E-COMPOSITION.md b/research/central-q-decoder/E-COMPOSITION.md new file mode 100644 index 0000000000..393e089712 --- /dev/null +++ b/research/central-q-decoder/E-COMPOSITION.md @@ -0,0 +1,85 @@ +# Completion of the newly supplied three-stage E caller + +Scope: a source-bound mathematical composition with the local physical contracts +of PR #5464 at 56ba6d7d609124d71c067d6a380caed573963f8f. Its PROOF, MODES and +PRECISION-SCOPE are retained unchanged. This package does not rerun that +41-file native verifier or claim an independently rebuilt physical E provider. + +Let P = E_3 E_2⁻¹ E_1. The source's actual F_1, B_2, F_3 word, followed by its +ordinary signed swap, has endpoints Q⁻¹ P D_123 and P D_123 Q. The source supplies +ordinary E and E⁻¹ recoders, including their owned cleanup and rational costs. +The source positive decoder P⁻¹ already gives one independent R73 output. + +**Sufficient completion.** On the negative output alone execute, chronologically, + + Q, E_3⁻¹, E_2, E_1⁻¹, Q. + +Theorem 1 of PROOF.md gives the other independent R73 output on its original +input. No commutation with Q or between E stages is inserted. Every stage +recoder is the source's supplied ordinary routine. The addition is exactly +2v H1 jobs and three E/E⁻¹ evaluations, with v = 112³. The existing reusable +512-field recoding scratch suffices after the caller's owned cleanup. Gaussian +child workspace remains part of the inherited service contract. + +Counting the three local modules and both output decoders gives twelve total +E/E⁻¹ evaluations, three modal-query upper bills and three native/boundary upper +bills. `check_invoice.py` sums their actual MODES.json fields, retaining COPY, +CLEAR, OWN_ZERO, SCALE, SWAP and monomial work. Owned peak is bounded by the +source's v + 20,480 + 512 fields. This is a field-level upper bill, not a newly +proved TM running time or fixed-precision implementation. + +The complete Gaussian profile is + + targets: 2v H73, + paid: 3v (H8 + H9 + H15 + H16) + 61,440 H25 + 2v H1. + +Its rank-mass surplus is −1,536,000, or −375/343 per owner. The repaired exact +moment is negative at κ = 0.003027288235. Thus the composition supplies positive +Gaussian endpoints under the pinned local contracts but no profitable supplier. +The source's positive conditional screen was computed before paying this repair. + +## An explicit inverse polynomial and the correct norm bound + +The source C is real symmetric with spectrum {0, 98, −1078}, K² = I, KC = −C, +and E = K(I−C)⁻¹. Its spectral minimal-polynomial relation implies + + C³ + 980C² − 105644C = 0, + (I−C)⁻¹ = I − (981C + C²)/104663, + E = K + (981C + C²)/104663, + E⁻¹ = K + C, + 104663 = 97 · 1079. + +Multiplying (I−C) by the displayed polynomial gives I plus the displayed +zero polynomial divided by 104663. Multiplying by K and using KC = −C gives +the E formula. These are identities of the actual physical similarity too; +scalar coefficients are applied once, not tensor-powered. The checker verifies +the polynomial coefficients exactly and its values at every source eigenvalue. +No cheaper evaluation cost than the source recoder is claimed from this formula. + +Because K is a commuting orthogonal involution, the singular values of E are +1, 1/97 and 1/1079. Consequently ‖E‖₂ = 1 and ‖E⁻¹‖₂ = 1079. The full negative +decoder has operator norm at most 1079² = 1,164,241. Unlike the K decoder, it is +not unitary. Its incoming-error bound must include that amplification. + +For a schedule that evaluates each complete rational E code exactly before one +coordinatewise rounding, and rounds after each central bit butterfly, a sufficient +additional-error bound is + + 1079² (2f + 3) √N · 2⁻ᴮ, + +where N counts complex scalar cells. Add 1079² times incoming Euclidean error. +The proof is the same suffix-error telescoping argument: every suffix contains +at most two expanding E⁻¹ factors, one nonexpanding E factor and unitary Q layers. +Exact rational accumulators can be implemented with fixed common denominators +for this finite owner program; they have real storage and integer-arithmetic +cost. This statement does not validate intermediate rounding inside a cheaper +recoder, invoke the K-only dyadic grid, or omit the √N coordinate-to-field factor. +It supplies a sufficient decoder precision schedule, not the missing full-caller +precision/stock/TM admission. + +Credit the complete E construction and all source contracts to THU New Media +Research Center / PR #5464 and its retained Ali Romman, Dugongue, Dillon Amburgey, +native, Clifford and compiler predecessors. The conjugation completion and +spectral-polynomial calculation are elementary; this note claims their specific +source-bound application, with substantial OpenAI Codex assistance by one solo +worker, not literature priority or independent physical-provider verification. diff --git a/research/central-q-decoder/LICENSE b/research/central-q-decoder/LICENSE new file mode 100644 index 0000000000..261eeb9e9f --- /dev/null +++ b/research/central-q-decoder/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/central-q-decoder/MANIFEST.json b/research/central-q-decoder/MANIFEST.json new file mode 100644 index 0000000000..b05f7fada4 --- /dev/null +++ b/research/central-q-decoder/MANIFEST.json @@ -0,0 +1,130 @@ +{ + "schema_version": 1, + "files": [ + { + "path": ".gitattributes", + "size": 8, + "sha256": "705fd4d6451a31d36b3df7de96f83f30ac976c9b4a6d1e51671d8e2f33e2d0da" + }, + { + "path": "check_decoder.py", + "size": 6554, + "sha256": "300d5cd34441bc3febe0822022075e3ee56f28c5cb9dc6ed416954ee5e83fe4f" + }, + { + "path": "check_invoice.py", + "size": 5892, + "sha256": "cbb716ffbee1047b1cdcd1277a7228240424b553a55c173d3a61e72f583a480f" + }, + { + "path": "check_rounding.py", + "size": 2689, + "sha256": "013a75241a8509353c642569947fcf20e20ec8cdbe1baeadab7b235e4b9644f8" + }, + { + "path": "decoder.py", + "size": 6805, + "sha256": "f439ecfd6f85645667b923e686feab2dd3364711a0e7c011989800c49562ac86" + }, + { + "path": "E-COMPOSITION.md", + "size": 4709, + "sha256": "150c5f71eeb0ecb8623cd568ab0119ce8f0f75f507b1be19788d88fb2613bffc" + }, + { + "path": "LICENSE", + "size": 11357, + "sha256": "c71d239df91726fc519c6eb72d318ec65820627232b2f796219e87dcf35d0ab4" + }, + { + "path": "NOTICE.txt", + "size": 330, + "sha256": "32a975fe7070c34238b63044d09a817fea097e8d102403ad7165aee8efbf1173" + }, + { + "path": "PROOF.md", + "size": 11530, + "sha256": "bda3e472c83f72f75a8dd5760b63e4aaf9980cc15c73515c5baef5b78e81b0c3" + }, + { + "path": "README.md", + "size": 5822, + "sha256": "c82c66e6d2c88bda43c153e429143504739ffa9aa8f3b0fe4e409b43e63c137f" + }, + { + "path": "RESULT.json", + "size": 7618, + "sha256": "21e48a40a29eb4e1b3df3107200d049792fadaee1137c5991bf4bf4d6fae34ca" + }, + { + "path": "source/E-MODES.json", + "size": 5559, + "sha256": "55b7f800257c058b0c01ceb41e6609419c558bde7021c40e47a7784dc4b701b6" + }, + { + "path": "source/E-PINS.json", + "size": 574, + "sha256": "aea37ee9b47a67fc73f12c22c9335025de3ad9ef04512205afd494ade743ec21" + }, + { + "path": "source/E-PRECISION-SCOPE.md", + "size": 1631, + "sha256": "9f99ba0108d8d51a47bafb65b6de964128c6ad57c7c469be2c11d154bb7e71f5" + }, + { + "path": "source/E-PROOF.md", + "size": 12131, + "sha256": "0b7aee69687ca6baa045b3721f37c54a54aab7cf4f0eec9c352d9bae48482486" + }, + { + "path": "source/K-MODULE.json", + "size": 2934, + "sha256": "02cec9cb8ce148c9a2ee97a899338b330b4b3efd1455b4243466987e09b354a0" + }, + { + "path": "source/K-PROGRAM.json.gz", + "size": 1414847, + "sha256": "dd9d0ecae4aebbef05c8134f1772221c97d2bf818e7a2f464501dbfa9c2856c0" + }, + { + "path": "source/MOMENT-SOURCE.json", + "size": 376, + "sha256": "f954f8feb34b9aa29c382c2fe24208325665aa663bc673f162f140a8e2658779" + }, + { + "path": "source/moments.py", + "size": 17152, + "sha256": "0ce7e7137422d5ffeda22085c81fa88471bbe963100fdad62e659f1e3bf89326" + }, + { + "path": "source/PINS.json", + "size": 444, + "sha256": "a19ccaa8a36640b25ed2d58126ea8c90e54f05fe6c44f531aa784f6300dbfdf5" + }, + { + "path": "source/PROOF.md", + "size": 14853, + "sha256": "99e5b12bc5f5e67e5c1e49394dbb88746da46ae3d8760598c8b435b9d0baec9c" + }, + { + "path": "SOURCES.json", + "size": 1543, + "sha256": "6f05d691962e940c5b828c15704278844975bbc40d642f22d1ae8991359ec9b6" + }, + { + "path": "TASK.json", + "size": 4932, + "sha256": "01ff85729fe46d34a5bdd349bcc83bb18aabaeaef3aa70cd6a5508d2ebc8f724" + }, + { + "path": "VERIFY.json", + "size": 2034, + "sha256": "10a9d08dba041d2f194f086d8aa713c4171952a466047155f439a4c22347f90b" + }, + { + "path": "verify.py", + "size": 1821, + "sha256": "21c9688ed917d11b075c945cbe22e8b5c95582267afa3269554cdd2f34f57db2" + } + ] +} diff --git a/research/central-q-decoder/NOTICE.txt b/research/central-q-decoder/NOTICE.txt new file mode 100644 index 0000000000..b02143eed7 --- /dev/null +++ b/research/central-q-decoder/NOTICE.txt @@ -0,0 +1 @@ +Apache-2.0. Original adapter, tests and exposition: Dugongue with substantial OpenAI Codex assistance by one solo worker. Retained upstream author credits and notices are in README.md, PROOF.md and source files. The algebraic inverse identity and unitary stability principle are classical; no general theorem priority is claimed. diff --git a/research/central-q-decoder/PROOF.md b/research/central-q-decoder/PROOF.md new file mode 100644 index 0000000000..52787098db --- /dev/null +++ b/research/central-q-decoder/PROOF.md @@ -0,0 +1,204 @@ +# Exact paid closure of the central-Q terminal + +This is a constructive all-width decoder theorem and a source-bound implementation. +It closes the algebraic output interface. Its explicit additional Gaussian charges +are not funded by the previous whole-K p19 planning invoice, so it supplies no new κ. +No independent human review, Lean kernel audit or full multiplier admission is claimed. + +## 1. Fixed contract and construction + +Let V be a finite-dimensional complex Hilbert space. Let Q and D be invertible +operators with QD = DQ. Let C_1,...,C_m be explicitly executable invertible +ordinary recodings. Define P = C_m ... C_1, in chronological stage order. +The incoming terminal is the actual operator W = Q⁻¹ P D on an arbitrary input x. +There is no commutation hypothesis between Q and any C_j, or between two C_j. + +**Theorem 1 (complete terminal repair).** Execute, in this chronological order: + +1. Q on the terminal field; +2. C_m⁻¹, C_(m−1)⁻¹, ..., C_1⁻¹ on that field; +3. Q on the result. + +The endpoint is DQx, and the additional Gaussian bill is two rank-one jobs per +owner, independent of m. Stopping before step 3 gives Dx with one rank-one job. +All unrelated original fields are preserved. + +Proof. After the first step the field is PDx. The reversed inverse word gives +Dx. The last step gives QDx = DQx. Equivalently, with operator products acting +rightmost first, + + (Q P⁻¹ Q)(Q⁻¹ P D) = QD = DQ. + +The inverse stage order is essential. This is a universal operator identity, +not an extrapolation from width-one tests. A Gaussian is paid at both occurrences +of Q; Q² being monomial does not permit commuting either Q past P. + +The positive terminal PDQx needs only the ordinary inverse word. When all C_j +are involutions, as in the pinned whole-K construction, the inverse word uses +the same codes in reverse chronological order. It does not reverse individual +native erasures, borrow original helpers or reinterpret a coupled output as an +independent Gaussian target. + +## 2. Actual native realization of each ordinary inverse code + +The pinned PR #5464 root cube has 512 owners and a rational symmetric matrix K. +The checker reconstructs every entry of K² = I and Kᵀ = K. Each row has twelve +entries of magnitude 1/4 and sixty-four of magnitude 1/16; its absolute row and +column sums are 7. The actual normalized code is + + C = diag(L_i⁻¹) K diag(L_i). + +The source input-Y and output-X words supply the actual L_i and L_i⁻¹. +Every word consists of an invertible binary permutation and a real linear sign. +The checker validates all 512 inverse pairs, rather than substituting an identity +normalizer or a commuting abstract code. Therefore C² = I and C is unitary. + +At every positive address width f, apply each L_i independently to its f digit +columns and sum their phase exponents. Apply the scalar K coefficient once to +an entire field, not its f-th power. Adjacent lifted normalizers cancel, so the +same C² = I and unitarity statements hold at all widths. Fresh stages use the +explicit embedding (central axis 0, followed by their own 24 axes). The terminal +identity itself does not need freshness; only a separately claimed target-rank +invoice may need it. + +To evaluate C in place, clear 512 owned fields; apply L to the main bank; +accumulate K times that unchanged bank into the owned bank; swap the banks; +apply L⁻¹ to the new main bank; clear the old bank. All source reads finish +before any source is replaced. There is no alias between owned and main fields. +Arbitrary initial owned contents are cleared explicitly, and all owned fields +return to zero. Other independent cohorts are untouched. + +Per stage and per 512-owner cube this emits 38,912 scalar ADDs, 1,024 complete +normalizer maps, 512 field SWAPs and 1,024 CLEARs. Each complete normalizer map +is exactly two pinned P/D primitives. Peak owned storage is 512 fields and is +reused across stages and disjoint cubes. The recipe and fully expanded event +iterator bind all coefficients, owner indices, stage embeddings and clears. +The paid repair is 1,024 H1 jobs for a full-rank terminal cohort, or 512 H1 jobs +if its central target rank is dropped. These are extra charges beyond the caller. + +This executable source adapter is bound to the emitted root cube. The universal +argument applies to any cube with the same proved interface; all-family physical +geometry and absolute-phase validity remain the pinned upstream proof's claims. +This package does not pretend to replay all 2,744 cubes or an entire p19 caller. + +## 3. A literal alternative to recursive Q calls + +For one digit bit the Gaussian is + + (a,b) ↦ (((1+i)a+(1−i)b)/2, ((1−i)a+(1+i)b)/2). + +Apply it on each central bit, with all other coordinates and owners as spectators. +This gives Q_f = C_e raised to its f-fold tensor product. The inverse conjugates +the coefficients. `q_pass` executes this exact Gaussian-integer/dyadic rule and +retains absolute phases. A separate dense Hamming-distance formula verifies it +for widths 1 through 6. + +If N is the total number of complex scalar cells in the cohort, the two Q passes +use fN two-cell butterflies. The one-pass option uses fN/2. They require no +external Gaussian oracle, but cost O(fN) scalar work plus actual arithmetic and +movement. The factor f is variable. This implementation is not a fixed finite +ordinary word and is not priced at zero in the κ calculation. No unit-cost +arbitrary-precision, constant-size machine word or fixed-tape tariff is assumed. + +## 4. Exact precision and stable rounding + +**Theorem 2 (exact dyadic grid).** Suppose the terminal input has Gaussian-integer +coordinates divided by 2^g. A full decoder with m whole-K code stages has every +prefix on a dyadic grid of exponent at most + + g + 4m + 2⌈f/2⌉. + +For the one-pass option, g + 4m + ⌈f/2⌉ suffices. + +Proof. Each scalar code coefficient has denominator dividing 16, so an entire +out-of-place stage, including partial sums, costs at most four fractional bits. +Signed monomial maps change none. For k central butterfly layers, every matrix +coefficient is ((1+i)/2)^k times a unit Gaussian integer. Since (1+i)^2 = 2i, +the coefficients have denominator dividing 2^⌈k/2⌉. This covers every partial +Q pass. Add the stage and Gaussian bounds in chronological order. A simpler +implementation may reserve g + 4m + 2f bits instead. Exact-grid claims do not +remove limb-operation or storage costs. + +**Theorem 3 (energy and forward error).** Every complete code and Q layer is +unitary. At exact code-accumulation prefixes, the combined main/owned Euclidean +norm is at most √50 times the main input norm, hence less than 8 times it. +No factor 7^m is needed for this combined Euclidean bound. + +Proof. A partial K accumulation has entrywise absolute row and column sums at +most 7. Its spectral norm is at most √(7·7) = 7, by Cauchy–Schwarz applied with +absolute row/column weights. The immutable source bank has norm M and the +partial owned bank has norm at most 7M. Combine them in quadrature. Signed +monomial maps and swaps preserve energy; clearing removes energy. At the end +of each code, KᵀK = I restores the main norm to M. Repeat stage by stage. +The bound starts after the explicit initial CLEAR of arbitrary owned dirt. + +For a rounded implementation, use exact widened accumulators inside a code +stage and round once per final real/imaginary coordinate. Round once per +coordinate after each one-bit Q layer. If the output grid spacing is 2^−B, +round-to-nearest gives local Euclidean error at most √N·2^−B. There are +L = 2f + m such unitary layers, or L = f + m for the one-pass option. Therefore + + final error ≤ incoming error + L√N·2^−B. + +Proof. Write each rounded layer as z_(j+1) = U_j z_j + e_j. Telescoping expands +the final error into transported e_j terms and the transported initial error. +Every suffix is unitary, so the triangle inequality gives the displayed bound. +For desired additional error ε, the exact sufficient check is +L²N ≤ ε²·2^(2B). This avoids any floating acceptance criterion. + +A sufficient signed component payload reserves the fractional grid plus enough +integer bits for 8 times the input Euclidean norm, with sign and guard bits. +That norm may depend on problem size; this is not a constant-word claim. +The rounded implementation theorem describes a schedule, while the supplied +native sparse interpreter itself uses exact arithmetic. No complete caller +rounding, storage or tape audit is inferred from this decoder theorem. + +## 5. The complete repair charge and the κ boundary + +The inherited ideal whole-K p19 model has 19 negative cohorts per owner. Their +stage counts are 19, then two each of 1 through 9, totaling 109 code evaluations. +Repairing the whole word uses 38 H1 jobs per owner, compared with 218 for the +explicit naive strategy that repairs each stage separately. This saves 180 +H1 jobs against that comparator, not against the selected multiplier. + +The model's original rank-mass surplus is 18 per owner. Full repair changes it +to −20. Dropping one central target rank in each negative cohort costs 19 H1 +jobs and loses 19 target ranks, again giving −20. Exact outward rational moment +checks reject both repaired profiles at the selected κ = 0.003027288235, the +open numerical-headroom claim 0.0030272882489783, and 0.00344412. + +Among these two repair options the one-pass option always has the better +concave moment for 0 < t < 1: its improvement over full repair at target rank +r > 1 is 1 + (r−1)^t − r^t > 0. This follows by integrating t x^(t−1) over +[r−1,r], whose integral is strictly less than 1. Thus choosing some full repairs +cannot rescue the displayed model if all one-pass repairs already fail at the +same t. This comparison is scoped to these explicit repairs, not all callers. + +The arithmetic pins an inherited planning inventory. It does not assert that a +complete p19 physical controller has now been emitted. The useful positive +result is the exact, fully charged terminal decoder; profitable assembly remains +open and is not hidden inside its hypotheses. + +## 6. Attribution, overlap and limits + +The two-sided inverse identity and unitary error telescoping are elementary +classical algebra and numerical analysis, not claims of new general theorems. +The contribution is their concrete native-code adapter, chronological emitter, +actual lifted sparse replay, precision schedule and fully charged comparison. + +Credit THU New Media Research Center / PR #5464 for whole-K native data; Ali Romman +/ #5439 for odd-E8 geometry; Dugongue / #4929 and #5467 for preceding coded work; +Dillon Amburgey for the physical normalizers and coded caller; Cinna Davis / #4470 +and Ryanson Jonathan / #4516 for the controller lineage; zxv for the unchanged +outward moment engine; Cao Yifan, Jacob Alan Sussman, Chris R / Clear1nsight and +the retained native, compiler and analytic contributors. The previous local +programmable-stage release is an unpublished local predecessor, not a fabricated +GitHub PR. Its payload was preserved. + +The refreshed #5464 terminal-support appendix has head +fc5e6f611eb7a1121be23d6748ecceb61533041e. It excludes a fixed finite ordinary +postdecoder on its stated distinct-fresh single-cohort grammar. The present +construction pays Gaussian work (or uses width-dependent butterflies), so it +respects that boundary. Overlap review was bounded, not a priority guarantee. +New implementation and exposition: Dugongue with substantial OpenAI Codex +assistance from one solo worker, Apache-2.0. diff --git a/research/central-q-decoder/README.md b/research/central-q-decoder/README.md new file mode 100644 index 0000000000..bfb2c8c691 --- /dev/null +++ b/research/central-q-decoder/README.md @@ -0,0 +1,45 @@ +# A fully charged central-Q terminal decoder + +**The exact endpoint repair is implemented; a profitable κ improvement is not established.** For a terminal Q⁻¹ P D x, the chronological decoder Q → P⁻¹ → Q returns the independent Gaussian target DQx. Its inverse code stages run in reverse chronological order, without assuming that codes commute with Q or with one another. + +This package turns that elementary identity into an actual adapter for the pinned whole-K native data: scalar coefficients, signed normalizers, fresh-axis embeddings, owned storage, cleanup and both Gaussian charges are explicit. The emitter expands every ADD and owner operation. Counts are at the Gaussian/field-operation level; no complete machine tariff is claimed. A literal butterfly implementation also gives an oracle-free implementation with O(fN) scalar work; that variable-width work is not free in the recursion budget. + +- Full-rank repair: two additional H1 jobs per owner, regardless of the number of code stages. +- Lower-rank repair: one H1 job per owner, returning D instead of DQ. +- Exact grid: g + 4m + 2⌈f/2⌉ fractional bits suffice for full repair. +- Rounded schedule: added Euclidean error is at most (2f + m)√N·2⁻ᴮ with one rounded output per unitary layer; the supplied native interpreter is exact. + +For the inherited p19 planning inventory, repairing whole code words uses 38 H1 jobs per owner, versus 218 for a naive stage-by-stage repair. This comparison is not a saving over the selected multiplier. Even the cheaper lower-rank repair fails the full moment at the selected and tested open κ values. The complete p19 caller and an improved multiplier are not supplied. + +[PROOF.md](PROOF.md) gives the universal sufficient results and their scope. [RESULT.json](RESULT.json) records exact replays and price checks. `decoder.py --stages 19` prints the compact chronological plan; its `literal_events` iterator expands all source-bound field operations. `--output FILE` refuses to overwrite an existing plan. + +## Reproduce + +Python 3.12+, standard library only; no Git, network, Lean or external libraries: + +```sh +python -I -B research/central-q-decoder/verify.py +python -I -O -B research/central-q-decoder/verify.py +``` + +Checks include all 262,144 entries of K², 512 signed inverse normalizers, 1,536 lifted normalizer inverses, actual sparse native-code recovery at widths 1–3 and two genuinely noncommuting fresh stages, full event counts for 1 and 19 stages, and 27 exact rational rounding fixtures. Wrong inverse order, an omitted Gaussian and an omitted actual phase are rejected. Finite tests corroborate the written all-width proof; they are not Lean kernel verification or a full 2,744-cube physical replay. Hosted Linux CI has not been run. + +## New E-adapter checkpoint + +PR #5464 changed during this session to head 56ba6d7d609124d71c067d6a380caed573963f8f. [E-COMPOSITION.md](E-COMPOSITION.md) applies the generic decoder to its newly supplied three-stage E caller, retaining its local physical contracts and all field-level upper bills. This gives both H73 endpoints at an explicit extra cost of two H1 jobs per owner and three inverse-code evaluations. The completed bill fails the moment test too. The source E package was read and pinned; its full scientific replay was not rerun here. E is not unitary, so the K-specific dyadic-grid and unitary-rounding theorems are not applied to it. + +## Current overlap and provenance + +Canonical main was pinned to 32890bc5de034ab8fc93ac88ead7279a6a416d04. The current #5464 support appendix, at fc5e6f611eb7a1121be23d6748ecceb61533041e, explains why a fixed finite ordinary postdecoder cannot resolve its distinct-fresh terminal. This package explicitly pays the correction, respecting that result. Its scientific K data remain pinned to the earlier unchanged constructor payload, byte-compared with the latest head during this session. PR #5468 supplies numerical headroom on an unchanged complete profile, not permission to omit these new charges. PR #5467 and the preceding local programmable-stage package remain predecessors. + +The shared Lean library supplied navigation to linear-isometry norm preservation (`Mathlib/Analysis/Normed/Operator/LinearIsometry.lean`). No local source path is part of the payload, no Lean theorem is newly checked, and no dependency on an unverified library hit is assumed: the norm argument is written out here. The bounded PR/Discussion search does not prove novelty; the elementary conjugation and stability identities are explicitly credited as classical. + +## Open next questions + +1. Can a changed caller supply the *current* Q-times-terminal value through an already paid query? Bind the exact input version, owner, frame and later uses first. This could remove one decoder charge; no such reuse is assumed here. +2. Can an overlapping-stage or earlier-readout construction retain every independent Gaussian target with a positive complete bill? Start with a fully emitted small instance and its endpoints, because the fixed distinct-fresh postdecoder is already covered by #5464. +3. If a profitable caller appears, bind these exact code/precision operations to its limb arithmetic, movement, storage, stock, compiler and analytic contracts. Decoder correctness alone does not admit those costs. + +## Credit + +THU New Media Research Center / #5464; Ali Romman / #5439; Dugongue / #4929 and #5467; Dillon Amburgey; Cinna Davis / #4470; Ryanson Jonathan / #4516; zxv (the retained exact interval engine); Cao Yifan; Jacob Alan Sussman; Chris R / Clear1nsight; and the retained native, helper, Clifford, compiler and analytic contributors. Existing source notices are preserved. Original adapter, checks and exposition prepared for Dugongue with substantial OpenAI Codex assistance by one solo worker. Apache-2.0. diff --git a/research/central-q-decoder/RESULT.json b/research/central-q-decoder/RESULT.json new file mode 100644 index 0000000000..93fe7f82e1 --- /dev/null +++ b/research/central-q-decoder/RESULT.json @@ -0,0 +1,226 @@ +{ + "check_decoder.py": { + "status": "PASS_EXACT_PAID_CENTRAL_Q_DECODER", + "source": { + "scalar_matrix_entries": 262144, + "inverse_normalizers": 512, + "lifted_inverse_cases": 1536 + }, + "free_noncommuting_word_cases": 3, + "gaussian_widths": 6, + "actual_native_sparse_replays": [ + { + "stages": 1, + "width": 1, + "input_terms": 2, + "coded_terminal_terms": 304, + "restored": true + }, + { + "stages": 1, + "width": 2, + "input_terms": 2, + "coded_terminal_terms": 1216, + "restored": true + }, + { + "stages": 1, + "width": 3, + "input_terms": 2, + "coded_terminal_terms": 4864, + "restored": true + }, + { + "stages": 2, + "width": 1, + "input_terms": 2, + "coded_terminal_terms": 3402, + "restored": true + } + ], + "emission_cases": 7, + "all_width_evidence": "PROOF.md; finite executions corroborate rather than replace it", + "new_kappa": false, + "profitable_closure": false + }, + "check_rounding.py": { + "status": "PASS_UNITARY_ROUNDING_CORROBORATION", + "dense_fixture_cases": 27, + "max_cells": 256, + "rounding": "nearest ties to even", + "scope": "Generic small unitary-code fixtures; no rounded physical p19 caller is asserted." + }, + "check_invoice.py": { + "status": "PASS_EXACT_REPAIR_INVOICE", + "per_owner": true, + "owners": 1404928, + "negative_cohorts": 19, + "inverse_code_evaluations": 109, + "naive_per_stage_Q_jobs": 218, + "whole_word_Q_jobs": 38, + "saved_Q_jobs_against_naive_stagewise_repair": 180, + "full_targets": { + "25": 4, + "49": 4, + "73": 4, + "97": 4, + "121": 4, + "145": 4, + "169": 4, + "193": 4, + "217": 4, + "457": 2 + }, + "full_paid": { + "1": 58, + "8": 19, + "9": 19, + "15": 19, + "16": 19, + "24": 4, + "48": 4, + "72": 4, + "96": 4, + "120": 4, + "144": 4, + "168": 4, + "192": 4, + "216": 4 + }, + "drop_central_targets": { + "24": 2, + "25": 2, + "48": 2, + "49": 2, + "72": 2, + "73": 2, + "96": 2, + "97": 2, + "120": 2, + "121": 2, + "144": 2, + "145": 2, + "168": 2, + "169": 2, + "192": 2, + "193": 2, + "216": 2, + "217": 2, + "456": 1, + "457": 1 + }, + "drop_central_paid": { + "1": 39, + "8": 19, + "9": 19, + "15": 19, + "16": 19, + "24": 4, + "48": 4, + "72": 4, + "96": 4, + "120": 4, + "144": 4, + "168": 4, + "192": 4, + "216": 4 + }, + "repaired_rank_mass_surplus": -20, + "tests": [ + { + "tested_kappa": "605457647/200000000000", + "ideal_unrepaired_margin": [ + "47447480636830959414823383081817837582809940324292944396375/6277101735386680763835789423207666416102355444464034512896", + "47447480636830959414823383081817837582809940324292951892699/6277101735386680763835789423207666416102355444464034512896" + ], + "full_repair_margin": [ + "-191082385307862909610936615000073486229079566565340367093673/6277101735386680763835789423207666416102355444464034512896", + "-191082385307862909610936615000073486229079566565340359597349/6277101735386680763835789423207666416102355444464034512896" + ], + "drop_central_margin": [ + "-94523248174137788442948436616615154140527058033321960718185/3138550867693340381917894711603833208051177722232017256448", + "-189046496348275576885896873233230308281054116066643913936821/6277101735386680763835789423207666416102355444464034512896" + ] + }, + { + "tested_kappa": "30272882489783/10000000000000000", + "ideal_unrepaired_margin": [ + "23723740169032868145871807358069240851896128936999808377333/3138550867693340381917894711603833208051177722232017256448", + "23723740169032868145871807358069240851896128936999812161415/3138550867693340381917894711603833208051177722232017256448" + ], + "full_repair_margin": [ + "-95541192803314066367008191682876421054048624507816847367691/3138550867693340381917894711603833208051177722232017256448", + "-95541192803314066367008191682876421054048624507816843583609/3138550867693340381917894711603833208051177722232017256448" + ], + "drop_central_margin": [ + "-189046496637719774367540181035079527865422399455877562442821/6277101735386680763835789423207666416102355444464034512896", + "-189046496637719774367540181035079527865422399455877554894831/6277101735386680763835789423207666416102355444464034512896" + ] + }, + { + "tested_kappa": "86103/25000000", + "ideal_unrepaired_margin": [ + "4819257914801378251717252864796671972719709065110915402333/784637716923335095479473677900958302012794430558004314112", + "9638515829602756503434505729593343945439418130221832693655/1569275433846670190958947355801916604025588861116008628224" + ], + "full_repair_margin": [ + "-24996975328285355376502746895439743503766479296093248533923/784637716923335095479473677900958302012794430558004314112", + "-49993950656570710753005493790879487007532958592186495178857/1569275433846670190958947355801916604025588861116008628224" + ], + "drop_central_margin": [ + "-98831143001103638846163382100555992236775510448232130560331/3138550867693340381917894711603833208051177722232017256448", + "-197662286002207277692326764201111984473551020896464253576783/6277101735386680763835789423207666416102355444464034512896" + ] + } + ], + "newest_E_completion": { + "status": "PASS_RETAINED_E_N3_COMPOSITION_AND_COMPLETE_FIELD_BILL", + "endpoint": "diag(R73,R73) under the pinned E local contracts", + "negative_decoder_chronology": [ + "Q", + "E3_inverse", + "E2", + "E1_inverse", + "Q" + ], + "paid": { + "8": 4214784, + "9": 4214784, + "15": 4214784, + "16": 4214784, + "25": 61440, + "1": 2809856 + }, + "targets": { + "73": 2809856 + }, + "ordinary_upper": { + "ADD": 2775106560, + "CLEAR": 25411584, + "OWN_ZERO": 21135360, + "SCALE": 11083776, + "SWAP": 26342400, + "field_monomial_pass": 50577408, + "COPY": 4276224, + "D": 63221760, + "P": 63221760, + "X": 84295680, + "phase": 25288704 + }, + "owned_peak_field_upper": 1425920, + "rank_mass_per_owner": "-375/343", + "moment_margin_per_owner": [ + "-4023047588817187303316956439139127934605908697065298797407307/2153045895237631501995675772160229580723107917451163837923328", + "-1005761897204296825829239109784781983651477174266324684252247/538261473809407875498918943040057395180776979362790959480832" + ], + "spectrum_norm_E": "1", + "spectrum_norm_E_inverse": "1079", + "negative_decoder_operator_norm_upper": 1164241, + "scope": "Source-bound algebraic composition and field-level upper bill. The upstream E physical proof is retained; its full 41-file replay, ordinary TM tariff and odd-denominator precision implementation are not newly supplied.", + "k_specific_unitary_precision_applies": false, + "new_kappa": false + }, + "new_kappa": false, + "scope": "Decoder bills are constructive. The p19 inventory is inherited planning arithmetic; no complete p19 native/controller emission or multiplier admission is claimed." + } +} diff --git a/research/central-q-decoder/SOURCES.json b/research/central-q-decoder/SOURCES.json new file mode 100644 index 0000000000..daeb1914e7 --- /dev/null +++ b/research/central-q-decoder/SOURCES.json @@ -0,0 +1,36 @@ +{ + "schema_version": 1, + "base_commit": "32890bc5de034ab8fc93ac88ead7279a6a416d04", + "files": [ + { + "path": "docs/research/agent-task-catalog.json", + "usage": "provenance", + "git_blob": "f126dd2e2dad2b669e75d1d0d0bd05c600725602", + "sha256": "f7a48bfa2659b88378282a8eee7d9fe52cdf505594124c4d1686b58510fffd72" + }, + { + "path": "certificates/selected-result.json", + "usage": "provenance", + "git_blob": "fc3d4ba105e1f097d0d7d051a308281e86ab1446", + "sha256": "66974efdced4083c00025f97d95d83909a226cdf801edb9301c195c6641f6903" + } + ], + "frozen_component_sources": [ + "source/PINS.json", + "source/MOMENT-SOURCE.json", + "source/E-PINS.json" + ], + "source_export_contract": "All scientific inputs are vendored, content-hashed and checked without network access. Canonical catalogue/selected files are provenance-only.", + "recent_overlap": { + "canonical_main": "32890bc5de034ab8fc93ac88ead7279a6a416d04", + "whole_k_latest_reviewed_head": "56ba6d7d609124d71c067d6a380caed573963f8f", + "whole_k_scientific_data_pin": "3981f9539e63630681f6903e3c6a50b3a0d2f2dd", + "read_prs": [ + 5464, + 5468, + 5469 + ], + "coverage": "Latest 30 updated PR bodies; relevant source proofs and Discussion hub HTML. Recursive repository tree endpoint was truncated; no complete historical search is claimed.", + "E_extension": "The updated low-rank E proof, mode profile and precision scope were read; its complete replay was not rerun." + } +} diff --git a/research/central-q-decoder/TASK.json b/research/central-q-decoder/TASK.json new file mode 100644 index 0000000000..14730c239e --- /dev/null +++ b/research/central-q-decoder/TASK.json @@ -0,0 +1,71 @@ +{ + "schema_version": 1, + "task_id": "complex-new-helper-inventory", + "original_card": { + "id": "complex-new-helper-inventory", + "question": "Can a new local cost interface change the deficit-to-recursive-cost ratio beyond current packing?", + "starting_points": [ + "docs/research/research-family-status.md", + "research/complex-local-word-ceiling/README.md", + "research/heterogeneous-owner-assembly/README.md", + "certificates/selected-result.json", + "research/selected-k8-unrestricted-ends/README.md" + ], + "methods": [ + "Propose a changed helper inventory and derive an optimistic exact moment.", + "Design a small completed instance and independently verify its endpoint and rank bill." + ], + "acceptance_gate": "A new physically realizable contract outside the frozen catalogue whose per-call profile, screened with ceiling.ceiling(), beats the selected word's packing ceiling; a lower cap does not establish identical circuitry or order attainable optima, and is insufficient to pass the stronger-budget target under this model. 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.", + "bottleneck_link": "Packing of the selected word is capped at +0.87% (ceiling model); only a lower local excess spend or a changed coverage law raises the cap.", + "allowed_variations": [ + "Narrow to one changed boundary or helper type with explicit counts.", + "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": [ + "Mixing only providers already inside the pinned catalogue.", + "Only changing helper terminal subspaces and monotone frames within the fixed scalar word, entrances and cleanup contract already covered by #1995/#2013.", + "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": [ + "helper inventory", + "heterogeneous-owner", + "mutable leaver" + ] + }, + "scope_status": "changed", + "scope_change_reason": "Explicit donor assignment: close the central-Q gauge, working solo.", + "actual_scope": "Construct and replay an exact fully charged all-width terminal decoder, with a lower-rank variant, precision theorem and complete repair invoice. Profitable closure is not established.", + "bottleneck_link": "The central-Q placement has an exact paid repair; its cost consumes the inherited whole-K p19 modeled gain.", + "stop_rule": "Retain the proved constructive decoder and honest full-cost comparison; do not promote an unfunded profile to a new kappa.", + "evidence": "Exact native lifted code and inverse replays, all scalar matrix entries, explicit emitted bills, noncommuting/phase controls and rational rounding/moment checks.", + "author": "Dugongue", + "ai_assistance": "Substantial OpenAI Codex assistance by one solo worker.", + "outcome": "partial", + "base_commit": "32890bc5de034ab8fc93ac88ead7279a6a416d04", + "new_kappa_claimed": false, + "open_questions": [ + { + "question": "Reuse a genuinely current central query in the terminal repair.", + "why_it_matters": "It could remove one paid Q layer.", + "first_step": "Bind a named chronological query version to Q times the exact terminal.", + "blocked_by": "No such current-value readout is supplied here." + }, + { + "question": "Change the caller and fund the remaining closure.", + "why_it_matters": "The explicit repaired p19 model has negative moment.", + "first_step": "Emit an overlapping-stage or earlier-readout instance with all independent outputs and a full bill.", + "blocked_by": "A profitable complete chronological construction is absent." + } + ] +} diff --git a/research/central-q-decoder/VERIFY.json b/research/central-q-decoder/VERIFY.json new file mode 100644 index 0000000000..71204633f8 --- /dev/null +++ b/research/central-q-decoder/VERIFY.json @@ -0,0 +1,58 @@ +{ + "schema_version": 1, + "status": "ready", + "python": "3.12", + "requirements": [], + "inputs": [], + "commands": [ + { + "argv": [ + "{python}", + "-I", + "-B", + "{package}/verify.py" + ], + "checks": "Exact native terminal recovery, owned routing, scalar and phase source checks, unitary rounding fixtures and complete repair invoices. No new kappa.", + "timeout_seconds": 180 + }, + { + "argv": [ + "{python}", + "-I", + "-O", + "-B", + "{package}/verify.py" + ], + "checks": "Optimized-wrapper read-only replay with unchanged exact receipts and all explicit guards.", + "timeout_seconds": 180 + } + ], + "package_local_inputs": [ + "research/central-q-decoder/.gitattributes", + "research/central-q-decoder/E-COMPOSITION.md", + "research/central-q-decoder/LICENSE", + "research/central-q-decoder/MANIFEST.json", + "research/central-q-decoder/NOTICE.txt", + "research/central-q-decoder/PROOF.md", + "research/central-q-decoder/README.md", + "research/central-q-decoder/RESULT.json", + "research/central-q-decoder/SOURCES.json", + "research/central-q-decoder/TASK.json", + "research/central-q-decoder/VERIFY.json", + "research/central-q-decoder/check_decoder.py", + "research/central-q-decoder/check_invoice.py", + "research/central-q-decoder/check_rounding.py", + "research/central-q-decoder/decoder.py", + "research/central-q-decoder/source/E-MODES.json", + "research/central-q-decoder/source/E-PINS.json", + "research/central-q-decoder/source/E-PRECISION-SCOPE.md", + "research/central-q-decoder/source/E-PROOF.md", + "research/central-q-decoder/source/K-MODULE.json", + "research/central-q-decoder/source/K-PROGRAM.json.gz", + "research/central-q-decoder/source/MOMENT-SOURCE.json", + "research/central-q-decoder/source/PINS.json", + "research/central-q-decoder/source/PROOF.md", + "research/central-q-decoder/source/moments.py", + "research/central-q-decoder/verify.py" + ] +} diff --git a/research/central-q-decoder/check_decoder.py b/research/central-q-decoder/check_decoder.py new file mode 100644 index 0000000000..77c2520a11 --- /dev/null +++ b/research/central-q-decoder/check_decoder.py @@ -0,0 +1,122 @@ +"""Independent exact checks for native data, lift, decoder and charges.""" +from pathlib import Path +from fractions import Fraction +from collections import Counter +import importlib.util, json, sys, time +ROOT=Path(__file__).resolve().parent +# Compile audited source bytes directly; do not trust pre-existing bytecode. +ns={'__name__':'decoder_checked','__file__':str(ROOT/'decoder.py')} +exec(compile((ROOT/'decoder.py').read_bytes(),str(ROOT/'decoder.py'),'exec',dont_inherit=True,optimize=0),ns) +need=ns['need'] + +def data_checks(cube): + ports=cube.ports;rows=cube.rows;need(len(ports)==512,'512 actual ports') + entries=0 + for i,row in rows.items(): + need(len(row)==76 and sum(abs(a)for a in row.values())==112,'76 terms and row norm seven') + product=Counter() + for j,c in row.items(): + need(rows[j].get(i)==c,'K symmetric') + for k,d in rows[j].items():product[k]+=c*d + need({k:v for k,v in product.items()if v}=={i:256},'Every entry of K squared equals identity') + entries+=512 + for p in ports: + fw,bw=cube.forward[p],cube.inverse[p] + need([x[0]for x in fw]==['P','D'] and [x[0]for x in bw]==['D','P'],'Source normalizer grammar') + G=fw[0][1];Gi=bw[1][1] + need(all(ns['mv'](Gi,ns['mv'](G,1<1:need(reduce([1]+list(reversed(pi))+[1]+w)!=[],'Wrong inverse-order mutation') + return 3 + +def run(): + cube=ns['Cube'](ns['source']()) + return {'status':'PASS_EXACT_PAID_CENTRAL_Q_DECODER','source':data_checks(cube),'free_noncommuting_word_cases':word_checks(),'gaussian_widths':gaussian_checks(), + 'actual_native_sparse_replays':native_replays(cube),'emission_cases':emission_checks(cube), + 'all_width_evidence':'PROOF.md; finite executions corroborate rather than replace it', + 'new_kappa':False,'profitable_closure':False} +if __name__=='__main__':print(json.dumps(run(),indent=2)) diff --git a/research/central-q-decoder/check_invoice.py b/research/central-q-decoder/check_invoice.py new file mode 100644 index 0000000000..1f5677731f --- /dev/null +++ b/research/central-q-decoder/check_invoice.py @@ -0,0 +1,94 @@ +"""Exact full-cost comparison for the inherited ideal whole-K p19 inventory. +This arithmetic does not assert that the controller has been emitted. +""" +from pathlib import Path +from fractions import Fraction as Q +from collections import Counter +from hashlib import sha256 +import json +ROOT=Path(__file__).resolve().parent + +def need(ok,msg): + if not ok:raise ValueError(msg) + +def engine(): + src=ROOT/'source/moments.py';pin=json.loads((ROOT/'source/MOMENT-SOURCE.json').read_text()) + need(sha256(src.read_bytes()).hexdigest()==pin['sha256'],'Interval-engine source') + ns={'__name__':'credited_interval_engine','__file__':str(src)} + exec(compile(src.read_bytes(),str(src),'exec',dont_inherit=True,optimize=0),ns) + return ns + +def invoice(): + # 19 FULLs on odd positions and 20 QUERYs on even positions. + # One full main pair, nine initial pairs, nine terminal pairs. + sizes=[19]+[j for j in range(1,10)for _ in range(2)] + T=Counter();P=Counter({1:20,8:19,9:19,15:19,16:19}) + for m in sizes:T[24*m+1]+=2 + for j in range(1,10):P[24*j]+=4 + full=P.copy();full[1]+=2*len(sizes) + dropped=P.copy();dropped[1]+=len(sizes) + Td=T.copy() + for m in sizes:Td[24*m+1]-=1;Td[24*m]+=1 + return sizes,T,P,full,Td,dropped + +def e_completion(E): + pin=json.loads((ROOT/'source/E-PINS.json').read_text()) + for name,digest in pin['files'].items():need(sha256((ROOT/'source'/name).read_bytes()).hexdigest()==digest,'Changed E source') + src=json.loads((ROOT/'source/E-MODES.json').read_text()) + V=src['global_dimension'];modes=src['nonzero_global_modes'] + eigenvalues=sorted({sector['F_C_eigenvalue']for sector in src['sectors']}) + need(eigenvalues==[-1078,0,98],'Actual E spectrum') + D=97*1079 + need(D==104663 and D+981==105644,'Exact inverse-polynomial coefficients') + for x in eigenvalues: + need(x**3+980*x*x-105644*x==0,'Spectral annihilator') + need((1-x)*(1-Q(981*x+x*x,D))==1,'Exact inverse polynomial') + need(max(abs(Q(1,1-x))for x in eigenvalues)==1,'E operator norm') + need(max(abs(1-x)for x in eigenvalues)==1079,'E inverse operator norm') + need(V==112**3 and modes==20480 and Q(modes,V)==Q(5,343),'Actual mode ratio') + T={73:2*V};paid={r:3*V for r in (8,9,15,16)};paid[25]=3*modes;paid[1]=2*V + t=1-Q('0.003027288235');tm=E['moment'](T,t);pm=E['moment'](paid,t) + margin=(tm[0]-pm[1],tm[1]-pm[0]);need(margin[1]<0,'Completed N3 cost must not be granted as profitable') + rank_margin=sum(r*n for r,n in T.items())-sum(r*n for r,n in paid.items()) + need(Q(rank_margin,V)==-Q(375,343),'Complete E rank mass') + ordinary=Counter() + # Three local modules, each with two recodings, plus three positive and + # three negative output recodings: twelve E/E^-1 evaluations in total. + for name,factor in [('ordinary_E_code_per_evaluation',12),('ordinary_query_both_orientations_upper',3),('ordinary_native_inverse_transpose_and_boundaries_upper',3)]: + for op,n in src[name].items(): + if op!='reusable_owned_fields':ordinary[op]+=factor*n + return {'status':'PASS_RETAINED_E_N3_COMPOSITION_AND_COMPLETE_FIELD_BILL', + 'endpoint':'diag(R73,R73) under the pinned E local contracts', + 'negative_decoder_chronology':['Q','E3_inverse','E2','E1_inverse','Q'], + 'paid':paid,'targets':T,'ordinary_upper':dict(ordinary), + 'owned_peak_field_upper':max(src['global_inverse_owned_peak_upper'],src['reusable_scalar_K_scratch_fields']), + 'rank_mass_per_owner':str(Q(rank_margin,V)), + 'moment_margin_per_owner':[str(v/V)for v in margin], + 'spectrum_norm_E':'1','spectrum_norm_E_inverse':'1079', + 'negative_decoder_operator_norm_upper':1079**2, + 'scope':'Source-bound algebraic composition and field-level upper bill. The upstream E physical proof is retained; its full 41-file replay, ordinary TM tariff and odd-denominator precision implementation are not newly supplied.', + 'k_specific_unitary_precision_applies':False,'new_kappa':False} + +def run(): + E=engine();sizes,T,P,F,Td,Pd=invoice() + mass=lambda h:sum(r*n for r,n in h.items()) + need(mass(T)-mass(P)==18,'Inherited ideal rank mass') + need(mass(T)-mass(F)==mass(Td)-mass(Pd)==-20,'Full repair rank accounting') + tests=[] + for k in [Q('0.003027288235'),Q('0.0030272882489783'),Q('0.00344412')]: + t=1-k;ideal=E['moment'](T,t);paid=E['moment'](P,t) + fm=E['moment'](F,t);dt=E['moment'](Td,t);dp=E['moment'](Pd,t) + original=(ideal[0]-paid[1],ideal[1]-paid[0]);full=(ideal[0]-fm[1],ideal[1]-fm[0]);drop=(dt[0]-dp[1],dt[1]-dp[0]) + need(original[0]>0 and full[1]<0 and drop[1]<0,'Changed full-cost conclusion') + need(drop[0]>full[1],'One-pass lower-rank option has better concave moment') + tests.append({'tested_kappa':str(k),'ideal_unrepaired_margin':[str(x)for x in original], + 'full_repair_margin':[str(x)for x in full],'drop_central_margin':[str(x)for x in drop]}) + return {'status':'PASS_EXACT_REPAIR_INVOICE','per_owner':True,'owners':112**3, + 'negative_cohorts':len(sizes),'inverse_code_evaluations':sum(sizes), + 'naive_per_stage_Q_jobs':2*sum(sizes),'whole_word_Q_jobs':2*len(sizes), + 'saved_Q_jobs_against_naive_stagewise_repair':2*(sum(sizes)-len(sizes)), + 'full_targets':dict(sorted(T.items())),'full_paid':dict(sorted(F.items())), + 'drop_central_targets':dict(sorted(Td.items())),'drop_central_paid':dict(sorted(Pd.items())), + 'repaired_rank_mass_surplus':-20,'tests':tests,'newest_E_completion':e_completion(E),'new_kappa':False, + 'scope':'Decoder bills are constructive. The p19 inventory is inherited planning arithmetic; no complete p19 native/controller emission or multiplier admission is claimed.'} +if __name__=='__main__':print(json.dumps(run(),indent=2)) diff --git a/research/central-q-decoder/check_rounding.py b/research/central-q-decoder/check_rounding.py new file mode 100644 index 0000000000..10dd6e165f --- /dev/null +++ b/research/central-q-decoder/check_rounding.py @@ -0,0 +1,53 @@ +"""Exact finite corroboration of the unitary rounding theorem, separate toy cells. +These are small noncommuting code fixtures, not a rounded whole native caller. +""" +from fractions import Fraction as F +import json + +def need(ok,msg): + if not ok:raise ValueError(msg) +def energy(v):return sum(a*a+b*b for a,b in v) +def qlayer(v,f,bit): + size=1<<(2*f);out=[] + for i,(a,b) in enumerate(v): + owner,x=divmod(i,size);c,d=v[owner*size+(x^(1<>f + if (owner+stage)&1:a,b=b,a + return a|(b<value.denominator or (2*r==value.denominator and q&1):q+=1 + return F(q,1<>i&1) + theta+=2*sum(((rows[i]>>(i+1))&(x>>(i+1))).bit_count() for i in range(25) if x>>i&1) + elif op[0]=='X':x^=op[1] + elif op[0]=='phase':theta+=op[1] + else:raise ValueError('A Gaussian is hidden in a monomial word') + return x,theta%4 + +def lifted(word,address,f,axes): + """Stage axis j is the f-bit block axes[j]; scalars are never tensorized.""" + out=address;theta=0 + for col in range(f): + x=sum(((address>>(a*f+col))&1)<>j&1:out^=1<<(a*f+col) + return out,theta%4 + +def q_pass(state,e,f,sign=1): + """Literal central C^{tensor f}; no external numerical/oracle dependency.""" + need(sign in (-1,1),'Gaussian orientation') + need(type(f)is int and f>=1,'Positive address width') + for col in range(f): + out={} + for (owner,x),(a,b) in state.items(): + add(out,(owner,x),(a-sign*b,b+sign*a)) + add(out,(owner,x^(1<=0 and type(owners)is int and owners>0,'Invalid decoder dimensions') + events=[{'op':'GAUSSIAN_Q','rank':1,'count':owners}] + for s in reversed(range(stages)): + events += [{'op':'CLEAR_OWNED','count':owners}, + {'op':'NORMALIZE_L','stage':s,'count':owners}, + {'op':'ACCUMULATE_K_INTO_OWNED','stage':s,'ADD':76*owners,'denominator_exponent':4}, + {'op':'SWAP_WITH_OWNED','count':owners}, + {'op':'NORMALIZE_L_INVERSE','stage':s,'count':owners}, + {'op':'CLEAR_OWNED','count':owners}] + if keep_central: events += [{'op':'GAUSSIAN_Q','rank':1,'count':owners}] + return {'schema':'central-q-terminal-decoder/v1','chronological_events':events, + 'stage_order':list(reversed(range(stages))), + 'paid':{'1':(2 if keep_central else 1)*owners},'keep_central':keep_central,'owned_peak_fields_per_cube':owners if stages else 0, + 'ordinary':{'ADD':76*owners*stages,'normalizer_maps':2*owners*stages, + 'SWAP':owners*stages,'CLEAR':2*owners*stages}, + 'scope':'One coded negative terminal cohort. Gaussian charges are additional, not free. Exact arithmetic and tape/movement costs remain explicitly charged by the caller.'} + +def literal_events(cube,stages,keep_central=True): + """Fully expand owned routing and every actual source-bound scalar ADD. + MONOMIAL references a source definition, with explicit stage-axis embedding. + Each referenced definition is exactly two P/D primitives; it hides no Q. + """ + for p in cube.ports:yield ['PAID_Q','MAIN',p,1] + for stage in reversed(range(stages)): + for p in cube.ports:yield ['CLEAR','OWNED',p] + for p in cube.ports:yield ['MONOMIAL','MAIN',p,stage,'L'] + for r,row in cube.rows.items(): + for source,c in row.items():yield ['ADD','OWNED',r,'MAIN',source,c,16] + for p in cube.ports:yield ['SWAP','MAIN',p,'OWNED',p] + for p in cube.ports:yield ['MONOMIAL','MAIN',p,stage,'L_INVERSE'] + for p in cube.ports:yield ['CLEAR','OWNED',p] + if keep_central: + for p in cube.ports:yield ['PAID_Q','MAIN',p,1] + + +def run_recipe(cube,state,e,f,stages,keep_central=True): + state,e=q_pass(state,e,f) + for stage in reversed(range(stages)):state,e=cube.code(state,e,f,stage_axes(stage)) + return q_pass(state,e,f) if keep_central else (state,e) + +def gauge_input(cube,state,e,f,stages): + # W R^{-1}=Q^{-1} P Q^{-1}, with R=DQ and P=C_last ... C_first. + state,e=q_pass(state,e,f,-1) + for stage in range(stages):state,e=cube.code(state,e,f,stage_axes(stage)) + return q_pass(state,e,f,-1) + +def main(): + ap=argparse.ArgumentParser();ap.add_argument('--stages',type=int,default=19);ap.add_argument('--output',type=Path) + a=ap.parse_args();data=recipe(a.stages) + raw=json.dumps(data,indent=2)+'\n' + if a.output: + with a.output.open('x',encoding='utf8',newline='\n') as out:out.write(raw) + else:print(raw,end='') +if __name__=='__main__':main() diff --git a/research/central-q-decoder/source/E-MODES.json b/research/central-q-decoder/source/E-MODES.json new file mode 100644 index 0000000000..7a220081e4 --- /dev/null +++ b/research/central-q-decoder/source/E-MODES.json @@ -0,0 +1,192 @@ +{ + "base_C_rank": 8, + "base_dimension": 112, + "field_l2_Ecode_prefix_log2_upper": 15056, + "field_l2_query_prefix_log2_upper": 30096, + "finite_precision_statement": "Each fixed ordinary elementary ADD norm<=1+abs(c), SCALE norm<=max(1,abs(c)), owned COPY norm<=2, CLEAR norm<=1. Their explicitly counted finite product bounds field-l2 error growth uniformly in positive width; paid Gaussians and signed monomials are unitary. This supplies a finite precision offset, not the unproved outer TM/rounding/storage admission.", + "gather_scatter_GL_norm_product_denominator_bits": 4083, + "gather_scatter_GL_norm_product_numerator_bits": 5014, + "gather_scatter_ordinary_counts": { + "ADD": 129905664, + "SCALE": 1204224, + "SWAP": 1053696, + "field_monomial_pass": 5619712, + "mode_ADD": 20480, + "mode_CLEAR": 20480, + "mode_COPY": 20480 + }, + "global_dimension": 1404928, + "global_inverse_owned_peak_upper": 1425920, + "kernel_dimension": 104, + "literal_T_counts": { + "ADD": 863, + "SCALE": 8, + "SWAP": 7 + }, + "literal_T_inverse_counts": { + "ADD": 863, + "SCALE": 8, + "SWAP": 7 + }, + "nonzero_global_modes": 20480, + "normalizer_pin": "ae8aad06aa5d1811d725895b3ab5a4f4daa9dcdd88294aa0d5f723e78bb1e0da", + "ordinary_E_code_per_evaluation": { + "ADD": 171727360, + "CLEAR": 1404928, + "OWN_ZERO": 1404928, + "SCALE": 622592, + "SWAP": 1931776, + "field_monomial_pass": 2809856, + "reusable_owned_fields": 512 + }, + "ordinary_local_module_upper_recipe": "Two ordinary E/E^-1 code evaluations plus one query upper bill plus native inverse-transpose/boundary upper bill. This conservative unified bound covers both orientations; some COPY/ZERO/CLEAR counts intentionally dominate either orientation. Structured loop counts, not an expanded global event list. N3 uses3 modules and3 extra positive-output inverse-code evaluations.", + "ordinary_native_inverse_transpose_and_boundaries_upper": { + "ADD": 108179456, + "CLEAR": 2809856, + "COPY": 1404928, + "D": 21073920, + "OWN_ZERO": 1404928, + "P": 21073920, + "X": 28098560, + "phase": 8429568 + }, + "ordinary_query_both_orientations_upper": { + "ADD": 129946624, + "CLEAR": 40960, + "COPY": 20480, + "OWN_ZERO": 20480, + "SCALE": 1204224, + "SWAP": 1053696, + "field_monomial_pass": 5619712 + }, + "preflight": { + "N": 3, + "a": "0.003027288235", + "base_K_paid": { + "15": 4214784, + "16": 4214784, + "8": 4214784, + "9": 4214784 + }, + "certified_margin20480_interval": [ + "43820741317242277/1000000000000000000", + "21910370658621139/500000000000000000" + ], + "certified_margin22016_interval": [ + "1675342557712707/100000000000000000", + "16753425577127071/1000000000000000000" + ], + "conditional_margin20480": "0.0438207413172422775101525576292319429133590780577993092197236709544451", + "conditional_margin22016": "0.0167534255771270702133130179725927205959282918230585010329357979449582", + "correction_paid": { + "25": 61440 + }, + "per_port_local20480H25_cost": "0.3608975432015360972911938620885229642324104831298774424905049734598249", + "per_port_local_K_only_allowance": "0.40471828451877837480134641971775490714576956118767675171022864441427", + "scope": "Conditional preflight grants both coded E terminals as independent H73. This terminal grant is UNKNOWN and is not a constructed supplier, numerical kappa or formal admission.", + "target_grant": { + "73": 2809856 + } + }, + "query_owned_fields": 20480, + "query_paid_profile_per_full": { + "25": 20480 + }, + "rational_T_inverse_entries_checked": 12544, + "reusable_scalar_K_scratch_fields": 512, + "schema": "global20480-mode-query-proof/v1", + "scientific_program_sha256": "dcd81007497afa2f2a9cf948b62906a89375101590277c2adae6affeab44ec83", + "sectors": [ + { + "A_eigenvalue": 1, + "A_inverse_eigenvalue": "1", + "F_C_eigenvalue": 0, + "active_C_axes": [ + 0, + 0, + 0 + ], + "dimension": 1124864 + }, + { + "A_eigenvalue": 1, + "A_inverse_eigenvalue": "1", + "F_C_eigenvalue": 0, + "active_C_axes": [ + 0, + 0, + 1 + ], + "dimension": 86528 + }, + { + "A_eigenvalue": 1, + "A_inverse_eigenvalue": "1", + "F_C_eigenvalue": 0, + "active_C_axes": [ + 0, + 1, + 0 + ], + "dimension": 86528 + }, + { + "A_eigenvalue": -97, + "A_inverse_eigenvalue": "-1/97", + "F_C_eigenvalue": 98, + "active_C_axes": [ + 0, + 1, + 1 + ], + "dimension": 6656 + }, + { + "A_eigenvalue": 1, + "A_inverse_eigenvalue": "1", + "F_C_eigenvalue": 0, + "active_C_axes": [ + 1, + 0, + 0 + ], + "dimension": 86528 + }, + { + "A_eigenvalue": -97, + "A_inverse_eigenvalue": "-1/97", + "F_C_eigenvalue": 98, + "active_C_axes": [ + 1, + 0, + 1 + ], + "dimension": 6656 + }, + { + "A_eigenvalue": -97, + "A_inverse_eigenvalue": "-1/97", + "F_C_eigenvalue": 98, + "active_C_axes": [ + 1, + 1, + 0 + ], + "dimension": 6656 + }, + { + "A_eigenvalue": 1079, + "A_inverse_eigenvalue": "1/1079", + "F_C_eigenvalue": -1078, + "active_C_axes": [ + 1, + 1, + 1 + ], + "dimension": 512 + } + ], + "source_contact_extra_owned_for_inverse": 1404928, + "status": "PASS_EXPLICIT_RATIONAL_MODES_AND_INPLACE_ORDINARY_WORD", + "whole_caller_or_kappa": false +} diff --git a/research/central-q-decoder/source/E-PINS.json b/research/central-q-decoder/source/E-PINS.json new file mode 100644 index 0000000000..8bbd567165 --- /dev/null +++ b/research/central-q-decoder/source/E-PINS.json @@ -0,0 +1,11 @@ +{ + "repository": "thu-nmrc/integer-mult-bounds", + "commit": "56ba6d7d609124d71c067d6a380caed573963f8f", + "path": "research/odd-e8-lowrank-e-native", + "files": { + "E-MODES.json": "55b7f800257c058b0c01ceb41e6609419c558bde7021c40e47a7784dc4b701b6", + "E-PROOF.md": "0b7aee69687ca6baa045b3721f37c54a54aab7cf4f0eec9c352d9bae48482486", + "E-PRECISION-SCOPE.md": "9f99ba0108d8d51a47bafb65b6de964128c6ad57c7c469be2c11d154bb7e71f5" + }, + "usage": "Retained physical proof, spectrum and cost upper bounds; its complete scientific verifier is not rerun here." +} diff --git a/research/central-q-decoder/source/E-PRECISION-SCOPE.md b/research/central-q-decoder/source/E-PRECISION-SCOPE.md new file mode 100644 index 0000000000..50b6e60d55 --- /dev/null +++ b/research/central-q-decoder/source/E-PRECISION-SCOPE.md @@ -0,0 +1,9 @@ +# Precision gate: field-l2 amplification only + +The displayed elementary norm products give an operator-norm amplification constant G independent of positive field width f, when each error is supplied and measured as an additive error in the Euclidean norm of the whole physical field. Signed monomials and exact coordinate Gaussians have field-l2 norm one; scalar owner operations have the stated elementary bounds. + +This is not a proof that a fixed number of additional fixed-point bits suffices uniformly in f. If a field has N coordinates and each coordinate is rounded with absolute error at most epsilon, the resulting field-l2 error may be sqrt(N)*epsilon. N depends on the physical address dimension and f. The number of rounding sites, scalar-division realization and recursive Gaussian service tolerances must also be assigned under an actual coordinatewise precision/error ABI. None is removed by the constant G. + +The legacy phrase finite precision offset in the mathematical MODES receipt is to be read only as a finite multiplicative tightening of an already supplied field-l2 additive-error tolerance. It is not a fixed extra-bit claim, componentwise fixed-point theorem, complete rounding proof or TM admission. The recorded logarithmic bounds are logarithms of operator norms, not certified bit-precision overheads. + +The explicit rational coefficients and exact algebraic/native identities remain valid. Coordinatewise-to-field-l2 conversion, complete outer precision and bit costs, routing/storage admission and the negative E Gaussian terminal remain UNKNOWN. No exponent gain follows from the l2 constants alone. diff --git a/research/central-q-decoder/source/E-PROOF.md b/research/central-q-decoder/source/E-PROOF.md new file mode 100644 index 0000000000..ddf8539524 --- /dev/null +++ b/research/central-q-decoder/source/E-PROOF.md @@ -0,0 +1,92 @@ +# Source-consuming E adapters with one full-Gaussian query per spectral mode + +This is a local positive construction and a typed three-stage caller. It is not a completed Gaussian supplier or exponent improvement. In particular its negative E-coded terminal remains unresolved. + +## Operators and ordinary recodings + +Let Q be the positive Gaussian on the common central line, D the positive Gaussian on24 fresh axes and R=DQ. The phase-complete whole-K native module has + + F_K=diag(D,D)L(K Q^-1), + B_K=diag(D,D)U(-Q K), + K^2=I, K^T=K, [K,R]=0. + +Here K is the full physical owner/address code, including the real signed normalizers L_i, not the scalar owner matrix alone. Put C=F_3(C_base) in the same physical similarity, A=I-C, E=K A^-1. Then K C=-C and K commutes A. The actual C eigenvalues are0,98,-1078, so A is invertible. K,A,E are real symmetric and commute R. Every E evaluation is an explicit finite ordinary owner recoding; it is not a Gaussian child. Its rational denominators and rounding are charged ordinary arithmetic. + +Write H(T)=diag(T,Q^-1 T Q). For any same-stage invertible X commuting K, with E=KX, direct block multiplication gives + + postX(E) F_K preY(E) = H(E) diag(D,D)L(X^-1 Q^-1), + postX(E^-1) B_K preY(E^-1) = H(E^-1)diag(D,D)U(-Q X^-1). + +For X=A^-1 the residual coefficient is A, so a low-rank C correction suffices. This is different from treating the original H=F_3(B)-F_3(C) correction as a scalar-separated native bank. + +## Backward correction from actual original inputs + +Before any precode or native operation overwrites Y, copy its nonzero C modal coordinates into owned fields. Apply R to those mode fields. Between B_K and its postX(E^-1), scatter -R C Y_original into X. The complete corrected map is + + W_B=H(E^-1) B_0, + B_0=diag(D,D)U(-Q). + +Indeed the uncorrected adapter has upper right -R E^-1 A, and the scatter contributes -R E^-1 C. Since A+C=I, their sum is -R E^-1. The mode acquisition uses the original physical ground-chart Y; no QY or other Gaussian input is supplied for free. + +Here is the explicit global rank factorization used by the query. The pinned112-by8 root-mode matrix M satisfies M^T M=56I. Its eight columns span the base C eigenvalue14 space. `modes.py` emits a rational104-column kernel basis N and T=[M,N], together with T^-1. For y, its first8 coordinates are M^T y/56 and its104 remaining coordinates are the free coordinates of y-M(M^T y)/56. The emitted863 ADD,8 SCALE,7 SWAP word realizes each of T and T^-1 in place; every112-by112 entry is checked. + +In the three owner selector coordinates, use T tensor T tensor T. C has eigenvalue98 on the three sectors with exactly two8-dimensional active coordinates and one104-dimensional kernel coordinate, total19968; eigenvalue-1078 on the all-active sector, dimension512. There are therefore20480 nonzero modes. The explicit structured algorithm is: + +1. Apply each ordinary physical L_i to original Y_i. Apply the emitted T^-1 word on each owner axis and every fixed pair of other owner indices. +2. COPY the20480 nonzero modal coordinates into distinct owned zero fields. Invert the owner recoding and each L_i, restoring original Y before any native/precode overwrite. +3. Apply one full R25 Gaussian to each owned mode field. +4. Normalize the existing X bank by L_i and T^-1, ADD the signed eigenvalue-weighted mode outputs at the nonzero coordinates, restore T and L_i^-1, and CLEAR the owned modes after their final read. + +Scalar owner recodings commute with the common R. Every L_i commutes R exactly, including phase. Thus this algorithm adds -R C Y, at all positive field widths, with precisely20480 paid H25 children. Mode inputs are actual linear combinations of original inputs. These paid calls are not also counted as independent productive helper outputs. + +The E code uses the same modal basis, scaling sectors by1/(1-lambda) or1-lambda, followed by the literal block-diagonal K_odd owner recoding. For each512-port cube, the latter uses its76-per-row coefficients in512 owned output fields, then SWAPs completed outputs with main fields and clears the old main values now in owned scratch. No main source is overwritten before its last source read. The512 scratch fields are reused between cubes. The structured loops define all operations without serializing hundreds of millions of repeated scalar instructions. + +## Forward orientation without a free thin query + +A direct prequery C Q^-1 X would need a new source-extraction argument. Instead construct an actual inverse of W_B and transpose that linear program. + +Undo the postX(E^-1) by E. In the actual B_K word, every ADD has source Y and target X; no ADD modifies Y. Every one of its512 root-case Y fields is read at one unchanged physical common-frame contact,76 times. Execute all inverse Y operations first and COPY that contact value once per Y into owned scratch. This completes the actual inverse source path, obtaining E^-1 Y_original; apply ordinary E to recover Y_original. Now recompute R C Y_original by the same modal query, undo the scatter on X, and execute all reverse X operations and reverse ADDs using the saved physical Y contacts. Clear each owned contact after its final read. This computes W_B^-1, using the same native Gaussian profile and20480 H25 queries. It does not assume a scratch-containing word is invertible gate by gate. + +`checkpoint.py` parses the actual canonical B root512 program. It authenticates all38912 ADDs and512 source contacts, emits the inverse paths and owned lifecycle, and checks both composition orders against identity on all1024 independent main operator rows over a free algebra of arbitrary independent noncommuting invertible native event operators. It then transposes the actual owned inverse program and checks all operator entries. Each native inverse gate has an emitted literal monomial inverse or paid-path inverse; C_axes^-1=C_axes X_axis_mask exactly, with no omitted scalar phase. + +Transpose this independently constructed inverse program. Reverse instruction order, transpose each monomial/paid map, send ADD(target,source,c) to ADD(source,target,c), send an owned COPY to an accumulating ADD followed by clearing its old adjoint, and send discarded owned scratch to fresh zero adjoints. This is linear transposition with clean owned fields, not inverse execution of CLEAR. Each coordinate Gaussian is symmetric; transposition leaves its rank unchanged. The generic root512 replay checks this rule on all operator entries. The exact small fixture also checks original-input acquisition, all absolute phases and every entry of the resulting complete main matrix. + +Put J=diag(Q^2,I), an ordinary X-mask operation. Then + + diag(D^2,D^2) J W_B^-T J^-1 = H(E) F_0, + F_0=diag(D,D)L(Q^-1). + +To see this, H(E^-1)^-T=diag(E,Q E Q^-1). Conjugation by diag(D^2,D^2)J=diag(R^2,D^2) sends this to H(E), since E commutes R and therefore R^2. The remaining factor is the usual exact raw-dual boundary conversion. All boundary powers are monomial. Thus both orientations have the same paid profile + + {8:v,9:v,15:v,16:v,25:20480}, v=112^3. + +The old native H helper banks and their fragmented main paths are absent. Native monomials, mode recodings, contact COPY/CLEAR, all scalar arithmetic and precision remain real ordinary work. + +## Three distinct fresh stages and the unresolved terminal + +Let each stage have its own24 fresh axes and the same central Q. Each E_s commutes D_s Q and fixes other fresh axes. For H0=diag(I,Q), the corrected forward and backward maps become + + H0^-1 diag(E_s D_s,E_s D_s)L(I)H0, + H0^-1 diag(E_s^-1 D_s,E_s^-1 D_s)U(-I)H0. + +The three-call word F_1,B_2,F_3 has no IDLE or thin query. Adjacent H0 cancel; the scalar LUL is a signed swap. Keeping the actual ordinary final signed swap gives the two exact main endpoints + + Q^-1 B_E D_123, + B_E D_123 Q, + B_E=E_3 E_2^-1 E_1. + +An ordinary B_E^-1 postdecoder turns the positive half into independent H73 jobs on its original inputs. The negative half remains specified by its actual coupled operator. `n3.py` emits the corresponding owned three-fresh-stage small word and checks every column of its64-by64 exact complex-rational main matrix, including phases and positive output decoding. The naive B_E^-1 negative decoder is rejected. + +The same fresh-stage commutation premises permit the existing coded-caller IDLE algebra, with each chronological E code installed around an already-paid IDLE. That observation does not insert or grant any additional IDLE. The concrete N3 word used in the numerical screen needs none. + +If, only as a conditional screen, both halves were independent H73, the paid profile of3 full calls would be3v copies of ranks8,9,15,16 plus61440 H25. At a=.003027288235, its remaining signed moment is enclosed by an explicit rational log/exp Taylor calculation near +.04382074131724228 per port per local call. The earlier22016-feature variant gives +.01675342557712707. These are conditional margins, not accepted target credits. If the negative half merely became H71, the complete moment would already fail even before these extra queries. No free H71 decoder is sought here. + +## Precision, storage and scope + +All ordinary coefficients and basis words are explicit rationals. Elementary ADD has field-l2 norm at most1+abs(c), SCALE at most max(1,abs(c)), COPY at most2, CLEAR at most1; paid coordinate Gaussians and signed monomial maps have norm1 at every width. The explicitly finite instruction counts therefore give a finite operator-norm amplification constant, independent of field width, **relative to an additive-error ABI measured in field-l2 norm**. This is not a fixed extra-bit bound for coordinatewise fixed-point arithmetic. A vector with N coordinates and coordinate error at most epsilon can have l2 error sqrt(N)*epsilon; N grows with the physical field dimension. The coordinatewise rounding-to-l2 conversion, Gaussian-service error ABI, outer error allocation and bit-precision cost require separate proofs. Divisions by56,97,1079 and other fixed rational coefficients must be implemented and charged; they are not exact-real oracles. A complete outer TM, routing and storage admission is not supplied here. PRECISION-SCOPE.md states this gate explicitly. The source-contact inverse uses v owned fields in addition to the20480 query modes and the reusable512 scalar-code scratch; these fields are never credited as independent Gaussian outputs. + +The negative E terminal, its ordinary or paid decoding, and the full productive Gaussian invoice are UNKNOWN. Adding low-rank C changes the fitting-path hypothesis, so the proper-K terminal support cap cannot be silently reused as an E impossibility theorem. Conversely, full support of E paths is not an autonomous Gaussian certificate. No kappa, formally adopted algorithm or repository acceptance is claimed. + +Credits retain the whole-K phase compiler, CrocSwap repository/native/controller/Clifford lineage, Ali Romman's odd-E8 geometry and the existing coded caller. New work here is Apache-2.0 and has substantial OpenAI Codex assistance. The worker reviews and exact replays are not proof-kernel or independent human acceptance. + +The ordinary upper bills in MODES.json treat CODE(E) and CODE(E^-1) as explicitly realized ordinary linear macros. Their transposes may use the same recoder because each matrix is real symmetric; they need not literally reverse the scratch implementation. The query/source-contact portions are transposed with the explicit owned rules. The unified upper bill conservatively dominates both orientations. For one T/T^-1 pair let G be the product of the displayed elementary norm bounds. Disjoint owner batches form a direct sum, so each full axis pass has the same bound, rather than requiring its product over112^2 independent batches. A whole gather/scatter query has prefix field-l2 norm bounded by2*1079*G^6; the conservative CODE prefix bound is8*1079*G^3. The recorded binary logarithm upper bounds describe operator-norm amplification only. They are not fixed extra-bit offsets for coordinatewise rounding and do not establish TM precision costs. diff --git a/research/central-q-decoder/source/K-MODULE.json b/research/central-q-decoder/source/K-MODULE.json new file mode 100644 index 0000000000..2486521a39 --- /dev/null +++ b/research/central-q-decoder/source/K-MODULE.json @@ -0,0 +1,72 @@ +{ + "CLEAR": 0, + "COPY": 0, + "all_original_scalar_columns_checked": 1024, + "axis_dimension": 25, + "code_contract": { + "C_K_commutes_full_R": true, + "C_K_squared_identity": true, + "C_K_symmetric": true, + "proof": "K_odd symmetric involution and real orthogonal direct-owner normalizer similarity; each L_i commutes R exactly" + }, + "cube_tuple": [ + 0, + 0, + 0 + ], + "environment_metadata": { + "program_container_bytes": 1414847, + "program_container_sha256": "dd9d0ecae4aebbef05c8134f1772221c97d2bf818e7a2f464501dbfa9c2856c0" + }, + "helpers": 0, + "logical_growth": { + "max_scalar_denominator_exponent": 4, + "proof": "Each reader retains its own v plus76 distinct independent u terms:12 magnitudes1/4 and64 magnitudes1/16. Sources unchanged; all physical charts/wrappers unitary.", + "reader_max_row_l1": "8", + "source_max_row_l1": "1" + }, + "mutation_controls": { + "missing_actual_ADD_changes_independent_endpoint": true, + "same_tableau_phase_i_rejected": true, + "wrong_parity_common_chart_transport_rank": 2 + }, + "new_kappa": false, + "normalized_endpoint": "F_K=diag(D,D) L(C_K Q^-1), C_K=diag(L_i^-1) K_odd diag(L_i), D=C_[1,25), Q=C_0", + "normalized_entry": "All original x_i,y_i arbitrary independent at physical ground; all virtual-Q source-line entry wrappers are emitted ordinary monomials.", + "ordinary_literal_profile": { + "ADD": 38912, + "D": 7680, + "P": 7680, + "X": 3072, + "phase": 3072 + }, + "original_main_inputs": 1024, + "owned_fields": 0, + "paid_path_applications": 2048, + "paid_profile": { + "15": 512, + "16": 512, + "8": 512, + "9": 512 + }, + "phase_compilation": { + "all_positive_widths": "literal one-copy phases tensor lift; phase opcode theta becomes i^(f theta); owner scalar coefficients applied once", + "all_wrappers_monomial": true, + "low_rank_sparse_peak_support": 512, + "native_full_conjugate_analytic_anchors": 514, + "reader_output_wrappers": 512, + "source_input_wrappers": 512 + }, + "reader_endpoint": "D(y_i+sum_j K_odd[i,j] L_i^-1 L_j Q^-1 x_j)", + "reader_fields": 512, + "schema": "odd-E8-K-normalized-native-rootcase/v1", + "scientific_program_payload_sha256": "98941b295d428462b82dae52a369de97dcbf5be1dd7a369f6c495cda5fc6ac8a", + "scope": "Whole local block-diagonal K native constructor, with phase-complete emitted cube instance and generic forall2744 proof plus independent all-family geometry. It does not implement H, install F3, close any outer caller, admit precision/work/storage, or improve kappa.", + "source_endpoint": "D x_i on every independent original source x_i", + "source_fields": 512, + "source_pins": { + "NORMALIZERS.json": "ae8aad06aa5d1811d725895b3ab5a4f4daa9dcdd88294aa0d5f723e78bb1e0da", + "clifford_exact.py": "2982ead07721e83358dc67c6f49c2b4c16a236a6bebdfd72f58221be1f5d0962" + }, + "status": "PASS_PHASE_COMPLETE_K_NATIVE_ROOTCASE_AND_GENERIC_FAMILY_TEMPLATE" +} diff --git a/research/central-q-decoder/source/K-PROGRAM.json.gz b/research/central-q-decoder/source/K-PROGRAM.json.gz new file mode 100644 index 0000000000..86a14df78e Binary files /dev/null and b/research/central-q-decoder/source/K-PROGRAM.json.gz differ diff --git a/research/central-q-decoder/source/MOMENT-SOURCE.json b/research/central-q-decoder/source/MOMENT-SOURCE.json new file mode 100644 index 0000000000..d7d511b7c2 --- /dev/null +++ b/research/central-q-decoder/source/MOMENT-SOURCE.json @@ -0,0 +1,6 @@ +{ + "source": "research/higher-moment-strictification/verify.py", + "revision": "32890bc5de034ab8fc93ac88ead7279a6a416d04", + "url": "https://raw.githubusercontent.com/CrocSwap/integer-mult-bounds/32890bc5de034ab8fc93ac88ead7279a6a416d04/research/higher-moment-strictification/verify.py", + "sha256": "0ce7e7137422d5ffeda22085c81fa88471bbe963100fdad62e659f1e3bf89326" +} diff --git a/research/central-q-decoder/source/PINS.json b/research/central-q-decoder/source/PINS.json new file mode 100644 index 0000000000..01602a31a5 --- /dev/null +++ b/research/central-q-decoder/source/PINS.json @@ -0,0 +1,10 @@ +{ + "repository": "thu-nmrc/integer-mult-bounds", + "commit": "3981f9539e63630681f6903e3c6a50b3a0d2f2dd", + "path": "research/odd-e8-whole-k-native", + "files": { + "K-PROGRAM.json.gz": "dd9d0ecae4aebbef05c8134f1772221c97d2bf818e7a2f464501dbfa9c2856c0", + "K-MODULE.json": "02cec9cb8ce148c9a2ee97a899338b330b4b3efd1455b4243466987e09b354a0", + "PROOF.md": "99e5b12bc5f5e67e5c1e49394dbb88746da46ae3d8760598c8b435b9d0baec9c" + } +} diff --git a/research/central-q-decoder/source/PROOF.md b/research/central-q-decoder/source/PROOF.md new file mode 100644 index 0000000000..70d56ae3ff --- /dev/null +++ b/research/central-q-decoder/source/PROOF.md @@ -0,0 +1,326 @@ +# A complete native K primitive for every odd-E8 product cube + +This constructs the whole block-diagonal three-factor K service, including +the ordinary wrappers that normalize its actual supplied-line interface to +arbitrary ground-chart inputs. It does not produce the cross-cube H service, +install the low-rank F3 decoder, complete an outer caller or claim a kappa. + +The construction is a fixed finite structured word for all 14^3 cubes. +`core.calculate((a,b,c))` emits its exact literal instance for any cube. +The default finite phase replay fully emits cube(0,0,0); it does not pretend +to have expanded all 106,774,528 scalar ADDs or executed every phase instance. +The all-family result follows from the generic frame/phase proof below and +the independent all-2,744-cube geometry checks in `family_geometry.py`. + +Credits remain with Ali Romman's #5439 odd-E8 geometry, the P112/E8 data, +the PR5464 polarized native phase tools, the original native/Clifford +compiler lineage, and the coded-native-caller real centralizing normalizers. +This assembly and its explicit whole-K contract used substantial OpenAI +Codex assistance. New material is Apache-2.0. No independent human or +proof-kernel acceptance is asserted. + +## 1. Actual fields, scalar coefficients and global coordinates + +The pinned NORMALIZERS data supply 112 distinct binary q labels and their +root columns. The roots split into fourteen eight-root sign cubes. For a +cube b, put B_b=M_b M_b^T/4 and K_b=I-B_b. Exact rational checks give +K_b^2=I; each row has four entries +-1/2, all joining opposite selector +parities. The two four-port classes each span a three-space with pairing +rank one, and the two three-spaces are orthogonal. + +A product cube has 512 owners. Define + + K_odd=(K1+K2+K3-K1 K2 K3)/2. + +The three factor matrices commute and square to I. Expanding the square +of their displayed majority polynomial gives I. The scalar K_odd is also +symmetric. Every row has twelve distinct one-factor entries of magnitude +1/4 and sixty-four distinct three-factor entries of magnitude 1/16. +The two support sets are disjoint since each K_b has zero diagonal. +Every nonzero entry reverses total selector parity. Thus each row has +exactly 76 nonzero coefficients and their absolute sum is seven. + +The actual product labels are concatenated triples in F2^27. Their global +span U is the 25-space of equal three-block parities. The code records an +explicit orthonormal basis of U, and takes physical coordinates by dotting +against it. This is one global I25 realization, shared by all cubes; no +local-20-to-global-25 free adapter is introduced. Every port has norm one +and differs from the characteristic vector of U. The latter is the raw +all-ones27 vector, whereas each base label has weight three or seven. + +For every product cube the two 256-port parity classes span S0,S1 with + + dim S0=dim S1=9, S0 perpendicular S1, + rank(B|S0)=rank(B|S1)=1, dim rad(S0)=dim rad(S1)=8. + +Their joint span has dimension ten. `family_geometry.py` checks all +1,404,928 actual norm-one noncharacteristic labels, all 5,488 nine-space +classes and all opposite-reader/source-basis incidences. The restricted +characteristic issue is explicit: every odd q represents the characteristic +functional within S9. The construction never requires a noncharacteristic +vector inside S9, and never tries to orthonormalize this degenerate S9. + +Use two independent fields X_p,Y_p per port p. There are no other independent +fields, no owned full-field scratch, no COPY and no CLEAR. Across the family +the product cubes partition the actual owner indices, so no independent +input is duplicated or identified between cube instances. + +## 2. Canonical frames for arbitrary degenerate subspaces + +All operator products below act rightmost first. The primitive convention is + + C_q=((1+i)I+(1-i)X_q)/2. + +Write R=C_[0,25), Q=C_0 and D=C_[1,25), so R=DQ. If the columns of G are +any full binary basis and A=G^-1, put + + K_G=D_J P_G, J=I+A^T A. + +Here the diagonal uses the retained compiler's Z4 quadratic convention. +For the first r columns spanning S, the actual native frame is + + Phi_(G,r)=K_G C_[0,r) K_G^-1. + +It is not necessary for the restricted form on S to be nondegenerate. +Its binary symplectic action sends the Z Lagrangian to + + L_S={(x,z): x in S and z+x in S-perp}. + +To check this directly, let B=G P_r G^T. On a Z input z the output X part +is x=Bz, and its Z part is z+JBz. Since J=I+G^-T G^-1, the vector formed +by adding x to that output Z part is z+G^-T G^-1 x. Its dot product with +every first-r basis column vanishes. Dimensions give exactly L_S. +The symplectic action of C, and therefore of Phi, is an involution; +the inverse frame has the same Lagrangian image. + +Consequently two constructions of the same S differ by a monomial map. +If S is contained in T, their transition has Gaussian rank + + 25-dim(L_S intersect L_T)=dim T-dim S. + +Indeed their intersection has x in S and z+x in T-perp, hence dimension +dim S+25-dim T. This proves all required rank and zero-rank statements +for every actual cube, not only for the root instance's tableaux. + +## 3. Literal source and reader paths + +Fix a source parity class S9. All sources in it and all opposite readers +will meet at one and the same literal canonical Phi_S9 word. Each source +q belongs to S9. Its line-to-S9 path costs H8. To emit this path, choose +a full flag whose first vector is q and first nine vectors span S9. +Monomial gauges connect its one- and nine-dimensional frames to the +declared canonical frames, and the only Gaussian child is C_[1,9). + +A reader q is orthogonal to S9 and has norm one. Therefore it is outside +S9 and its q-perp24 contains S9. The reader starts at ground, reaches +Phi_S9 by one H9, and leaves it by one H15 to a full flag beginning with +the identical ordered S9 basis and spanning that actual q-perp24. +The emitted word supplies every reader's actual endpoint flag. + +The source leaves S9 for canonical full R by one H16. Let + + T_G=R K_G R^-1. + +The source-exit word executes K_G^-1, then C_[9,25), then T_G, since + + R Phi_S9^-1=T_G C_[9,25) K_G^-1. + +No extra Gaussian is hidden in T_G; its exact monomial phase is given +in section 4. All other gauges are compiled as P/D/X/phase-only words. + +At the common cut, directly execute Y_r += K_odd[r,s] X_s for every +nonzero scalar coefficient. The two main banks are independent. X is +never modified by these ADDs, so every source read uses its original +geometric logical value. Every reader retains its arbitrary old value +with coefficient one. There is no need for a rank-one cache or any +owned helper, even though the scalar matrix between the classes is full +rank. The two parity directions use disjoint source/reader field sets +and are executed separately. Every ADD is at an actually identical frame, +not merely between containing or cross-orthogonal subspaces. + +The geometric endpoint is exactly + + X_s: Phi_[q_s] u_s -> R u_s, + Y_r: v_r -> Phi_(q_r-perp)(v_r+sum_s K_odd[r,s]u_s). + +Every 512-port cube thus uses 512 children of each of widths 8,9,15,16, +and 38,912 ordinary scalar ADDs, with no helper or owned field. + +## 4. Absolute phases without exponential dense columns + +The retained signed tableau fixes a Clifford operator up to scalar. +Every low-rank monomial gauge is checked with an exact sparse +Gaussian-integer zero-column evaluation that fixes this scalar as well. +For same-S9 gauges the sparse support remains at most 512: after changing +coordinates, both rank-nine Gaussian portions act inside the same prefix. +The normalization gauges below need at most two one-axis Gaussians. + +For any native full basis G, let a_j=G^-1 e_j and set + + d_j=floor(wt(a_j)/2) mod 2. + +If q_J is the diagonal's actual Z4 phase, XOR Hamming-weight expansion +modulo four gives + + q_J(y)+wt(G^-1 y)=wt(y)+2d.y mod4. + +The quadratic cross terms cancel. For each j, its remaining linear +coefficient is alpha_j+wt(a_j), with alpha_j=(1+wt(a_j)) mod2 in {0,1}; +this equals 1+2d_j modulo four. With a=(1-i)/2, + + R^-1|0>=a^25 sum_x i^wt(x)|x>, + K_G R^-1|0>=Z_d R^-1|0>, + T_G|0>=(-i)^wt(d)|d>. + +Furthermore T_G is monomial: R^-1 takes Z Paulis to the diagonal +Lagrangian {(z,z)}, K_G takes it to {(Gz,Gz)}, and R takes it back to +Z Paulis. Its exact signed tableau plus this absolutely normalized +column determines the emitted P/D/X/phase word universally. No 2^25 +state is allocated. `frame_tools.py` retains this analytic anchor. + +These generic arguments prove the compiler construction for every cube +and every flag satisfying the verified geometry. Default execution fully +corroborates all actual root-case gauges, including 512 reader-output +full-basis anchors, rather than sampling a few field pairs. + +## 5. Real normalizers and virtual-Q entry + +The geometric input line service above is not silently assumed free in +the normalized native F_K. We explicitly wrap arbitrary ground inputs. +For each physical q, construct an orthogonal binary G_i taking e0 to q. +If q_0=0 use the even transvection T_(e0+q). Otherwise choose j>0 with +q_j=0 and use T_(ej+q) T_(e0+ej). Such j exists because q is not the +ambient characteristic vector. + +For row j of G_i put z_j=(wt(row_j)-1)/2 modulo two and define + + L_i=Z_z P_Gi. + +This is a real signed orthogonal monomial. Orthogonality cancels every +quadratic cross coefficient in the weight identity + + wt(G_i^-1 x)-wt(x)=2z.x mod4. + +It follows that L_i R L_i^-1=R exactly, including absolute phase. +Checking orthogonality and the 25 linear coefficients proves the weight +identity for all 2^25 addresses; no address sampling is used. + +The actual ordinary normalized wrappers are + + input X: Phi_[q_i] L_i Q^-1, + input Y: L_i, + output X: L_i^-1, + output Y: D L_i^-1 Phi_(q_i-perp)^-1. + +Their monomiality follows from the corresponding line/hyperplane +Lagrangian incidences. Input X's literal defining word has two one-axis +Gaussian factors and is compiled with exact sparse absolute phase. +It is emitted and executed as an ordinary monomial; Q^-1 is virtual +inside this identity, not an additional unpriced Gaussian instruction. + +For the potentially high-rank reader-output wrapper let its endpoint +flag be Phi_V=K_v C_[0,24) K_v^-1. The exact low-rank expression is + + D L_i^-1 Phi_V^-1 + =Q^-1 L_i^-1 T_v C_24 K_v^-1, + T_v=R K_v R^-1. + +This follows by C_[0,24)^-1=R^-1 C_24 and [L_i,R]=0. The right side +has only two one-axis Gaussian factors plus phase-complete monomials. +Its signed tableau is checked against the defining left side, and its +absolute phase is compiled from the low-rank expression. Thus no +rank-24 dense zero column is needed and no projective phase is discarded. + +## 6. Normalized arbitrary-input endpoint + +Let x_i,y_i be the actual independent ground inputs. After input wrappers +the geometric logical values are exactly + + u_i=L_i Q^-1 x_i, v_i=L_i y_i. + +These are invertible functions of the original independent inputs; they +are not being renamed originals or assumed zero. The actual emitted +input-X monomial already puts its physical field at Phi_[q_i]u_i. + +Source output followed by its wrapper is + + L_i^-1 R L_i Q^-1 x_i = D x_i. + +Reader output followed by its wrapper is + + D y_i + sum_j K_odd[i,j] D L_i^-1 L_j Q^-1 x_j. + +Define, at actual field width f, + + (C_K,f)_ij=K_odd[i,j] L_i,f^-1 L_j,f. + +The complete normalized operator is therefore + + F_K=diag(D,D) L(C_K Q^-1). + +K_odd is a real symmetric involution and the L_i are real orthogonal. +Thus C_K^T=C_K, C_K^2=I and [C_K,R]=0. These facts follow by actual +operator similarity. They do not tensor the whole owner matrix: +scalar K_odd coefficients are applied once, and cancellation of adjacent +L_j,f L_j,f^-1 proves the square identity at every positive width. + +All 1,024 geometric original columns are explicitly interpreted in the +root-case word; the incoming-column and outgoing-row factor identities +above imply all 38,912 nonzero normalized operator blocks at once. No +sampling of cross-owner physical operators is used. + +The normalized source outputs are autonomous rank-24 D transforms of +their original inputs. Reader outputs remain the specified triangular +coupled transforms. The service is invertible and retains every original +input; a complete outer Gaussian caller and its larger productive jobs +must still be supplied before using any whole-caller target profile. + +## 7. All positive widths and complete local accounting + +Every single-copy identity includes its absolute phase. Tensor it +columnwise to f positive address columns. P and X lift as binary block +maps, D sums its Z4 phase over the columns, and a single-copy phase theta +becomes i^(f theta). Scalar owner coefficients are applied once per field. +No width-one sum relation has been extrapolated by taking a tensor power +of a sum. This proves the actual physical word and F_K endpoint for every f. + +The normalized root case has 512 fields of each X/Y role and profile + + paid {8:512,9:512,15:512,16:512}, + ordinary {ADD:38912,P:7680,D:7680,X:3072,phase:3072}. + +There are 42 literal monomial primitives and 76 scalar ADDs per owner, +in addition to its four correctly charged Gaussian paths. These are +nonrecursive work, not zero-work operations. Their address movement, +storage, precision and tape price remain eventual caller obligations. +No helper input, helper target, owned field, COPY or CLEAR is introduced. + +For v=112^3=1,404,928, concatenate the cube words in lexicographic order. +The whole-family profiles are + + paid {8:v,9:v,15:v,16:v}, + ordinary {ADD:76v,P:15v,D:15v,X:6v,phase:6v}. + +The number of actual main inputs is 2v=2,809,856. The Gaussian rank mass +is 48v. No smaller pairing rank is substituted for any physical child. + +At geometric logical opcode boundaries each source row has l1 one and +each reader has its old value plus distinct source coefficients of total +l1 seven. Hence all prefix row l1 values are at most eight, and scalar +denominator exponent is at most four. Physical charts and wrappers are +unitary, so independent input norm at most M gives field norms at most +M for sources and 8M for readers. This is a finite local growth constant, +not a complete recursive rounding-error, precision or outer-admission bill. + +Actual mutation controls detect a global phase i despite an identical +signed tableau, a wrong parity S9 frame (requiring rank-two transport), +and omission of a literal K ADD (changing an independent input column). + +## 8. Remaining scope + +This fills the local K-native construction gate. It does not provide H, +remove H by a global basis change, make the F3 factor totals freely +available, prove a decoder/reader chronology, or close the mixed-Q +E=I-H interface. No whole-caller profit or kappa improvement is claimed. +The earlier planning profile and separated-helper obstruction cannot +be reused as a completed budget for this changed primitive. diff --git a/research/central-q-decoder/source/moments.py b/research/central-q-decoder/source/moments.py new file mode 100644 index 0000000000..4b24a50961 --- /dev/null +++ b/research/central-q-decoder/source/moments.py @@ -0,0 +1,421 @@ +#!/usr/bin/env python3 +"""Higher-moment strictification and a polynomial-logarithm compiler bound. + +New arithmetic is independent of predecessor interval code. The unchanged +invoice replay and two outer ledgers are credited, byte-pinned oracles. +zxv with substantial OpenAI Codex assistance. Apache-2.0. +""" +import argparse +import ast +from collections import Counter +from contextlib import redirect_stdout +from fractions import Fraction as Q +from functools import lru_cache +from hashlib import sha256, sha1 +import io +import json +from pathlib import Path + +HERE = Path(__file__).resolve().parent +GRID = 2**192 +C = Q('0.00268648') +KAPPA = Q('0.00268647') +T = {5:420, 6:270, 7:840, 8:1395, 9:3195, + 25:448, 41:448, 57:448, 121:224} +P = {1:37305, 2:10695, 3:3360, 4:1530, 5:300, + 8:1464, 16:448, 32:448, 48:448} + + +def need(ok, message): + if not ok: + raise ValueError(message) + + +def down(x): + return Q((x*GRID).__floor__(), GRID) + + +def up(x): + return Q(-((-x*GRID).__floor__()), GRID) + + +def rounded(lo, hi): + return down(lo), up(hi) + + +def mul(a, b): + products = [x*y for x in a for y in b] + return rounded(min(products), max(products)) + + +def scale(a, x): + return mul(a, (x, x)) + + +def divide(a, b): + need(b[0] > 0, 'positive interval denominator') + return mul(a, rounded(1/b[1], 1/b[0])) + + +@lru_cache(None) +def log_bounds(n): + """Exact atanh series, binary reduction; round only the final interval.""" + need(isinstance(n, int) and n >= 1, 'positive integer logarithm') + + def series(x): + u = (x-1)/(x+1) + term, total = u, Q(0) + for j in range(80): + total += 2*term/(2*j+1) + term *= u*u + tail = 2*term/(161*(1-u*u)) + return total, total+tail + + k = n.bit_length()-1 + a, b = series(Q(2)) + c, d = series(Q(n, 2**k)) + return rounded(k*a+c, k*b+d) + + +def exp_point(x): + """Outward fixed-point Taylor enclosure, with binary scaling/squaring.""" + need(abs(x) < 16, 'bounded exponential argument') + if x < 0: + a, b = exp_point(-x) + return rounded(1/b, 1/a) + divisions = 0 + while x > Q(1, 2): + x /= 2 + divisions += 1 + term = total = (Q(1), Q(1)) + for j in range(1, 65): + term = scale(term, x/j) + total = rounded(total[0]+term[0], total[1]+term[1]) + following = scale(term, x/65) + # Every remaining ratio is <= 1/132. Twice the next term is safe. + result = rounded(total[0], total[1]+2*following[1]) + for _ in range(divisions): + result = mul(result, result) + return result + + +def exp_interval(a): + return exp_point(a[0])[0], exp_point(a[1])[1] + + +@lru_cache(None) +def power(n, exponent): + return exp_interval(scale(log_bounds(n), exponent)) + + +def moment(histogram, exponent): + low = high = Q(0) + for n, count in histogram.items(): + a, b = power(n, exponent) + low += count*a + high += count*b + return rounded(low, high) + + +def display(a): + unit = 10**30 + + def fixed(n): + sign = '-' if n < 0 else '' + s = str(abs(n)).rjust(31, '0') + return sign+s[:-30]+'.'+s[-30:] + + return {'lower': fixed((a[0]*unit).__floor__()), + 'upper': fixed(-((-a[1]*unit).__floor__()))} + + +def encoded(x): + if isinstance(x, Q): + return str(x) + if isinstance(x, dict): + return {str(k): encoded(v) for k, v in x.items()} + if isinstance(x, (list, tuple)): + return [encoded(v) for v in x] + return x + + +def source_environment(path): + env = {'__file__': str(path), '__name__': 'pinned_source_oracle'} + exec(compile(path.read_bytes(), str(path), 'exec'), env) + return env + + +def authenticate(): + result = {} + for row in json.loads((HERE/'VENDOR.json').read_text())['files']: + path = HERE/'vendor'/Path(row['path']).relative_to( + 'research/higher-moment-strictification/vendor') + digest = sha256(path.read_bytes()).hexdigest() + need(digest == row['sha256'], 'changed source: '+row['path']) + raw = path.read_bytes() + need(sha1(b'blob '+str(len(raw)).encode()+b'\0'+raw).hexdigest() + == row['git_blob'], 'changed Git source blob') + result[row['path']] = digest + return result + + +def invoice_oracle(): + """Run #4426 unchanged, rebinding only its two file-location globals.""" + path = HERE/'vendor/invoice-review/verify.py' + env = source_environment(path) + env.update(ROOT=path.parent, PHASES='DATA-PHASES.json') + output = io.StringIO() + with redirect_stdout(output): + env['main']() + result = json.loads(output.getvalue()) + need(result['status'] == 'PASS_PR4416_INVOICE_REBUILD', 'source invoice oracle') + need({int(k): v for k, v in result['targets'].items()} == T + and {int(k): v for k, v in result['paid'].items()} == P, + 'exact literal-word invoice') + return result + + +def tail_certificate(v=150, cutoff=10, floor=15, u=Q(3, 10)): + t = 1-C + need(v >= 1 and 1 < cutoff < floor < 121, 'strict finite ranks') + need(t+u >= 1, 'tail moment exponent at least one') + target, paid = moment(T, t), moment(P, t) + alpha = divide(paid, target) + gamma = divide(moment(P, t+u), mul(power(cutoff, u), target)) + delta = divide((Q(sum(T.values())*floor),)*2, + mul(power(cutoff, C), target)) + limits = (1-Q(1, 10**8), Q(181, 200), Q(439, 500)) + for name, bounds, limit in zip(('alpha', 'gamma', 'delta'), + (alpha, gamma, delta), limits): + need(0 < bounds[0] <= bounds[1] < limit < 1, name+' certified limit') + a, g, d = limits + bound = 1/(1+v*(1-a))+2*g**v+2*d**v + need(bound < 1, 'complete charged normalized moment') + old_gamma = divide((Q(sum(k*n for k, n in P.items())),)*2, + mul(power(cutoff, C), target)) + old_lower = alpha[0]**v+2*old_gamma[0]**v + need(old_lower > 1, 'rank-one-tail estimate fails at this tensor power') + return {'tensor_power': v, 'cutoff_base': cutoff, 'floor_base': floor, + 'paid_moment_exponent': t+u, 'tail_offset_u': u, + 'tested_saving': C, 'alpha': display(alpha), 'gamma': display(gamma), + 'delta': display(delta), 'rational_upper_limits': limits, + 'normalized_paid_upper': bound, 'strict_moment_gap': display((1-bound,)*2), + 'old_rank_one_gamma': display(old_gamma), + 'old_rank_one_bound_lower': display((old_lower, old_lower)), + 'ambient': '121^'+str(v), 'minimum_target': str(floor)+'^'+str(v), + 'maximum_paid': str(cutoff)+'^'+str(v), + 'productive_fields_before_uniform_compiler': '7688^'+str(v), + 'rank_one_surplus': '131723^'+str(v)+'-131115^'+str(v), + 'materialized_product_or_uniform_word': False} + + +def uniform_rank(v): + t, p, theta = 1-C, 13, Q(6, 7) + gap = (C-KAPPA)/7 + uniform_saving = C-gap + need(10**7 < 15**6, 'theta upper bound') + need(2*(10**v)**7 <= (121**v)**6, 'shifted logarithm inequality') + eta = scale(exp_interval(scale(log_bounds(121), -v*C)), t) + need(eta[0] > theta**p, 'exit contraction below complement capacity') + base = exp_interval(scale(log_bounds(121), v*C)) + need(base[1] < 2**p, 'entire ordinary base range fits') + # Integer grid: gap*H is integral, avoiding enormous rational powers. + step = gap.denominator + need(gap.numerator == 1, 'chosen rational gap grid') + + def passes(j): + H = step*j + return (H+1)**p < 2**j + + lo, hi = 1, 2 + while not passes(hi): + lo, hi = hi, 2*hi + while hi-lo > 1: + mid = (lo+hi)//2 + if passes(mid): + hi = mid + else: + lo = mid + H = step*hi + need(H > 7*v and passes(hi) and not passes(hi-1), 'final integer comparison') + need(eta[1] < theta**(p-1), 'one smaller logarithmic power fails') + return {'t': t, 'uniform_saving': uniform_saving, 'gap': gap, + 'logarithm_power': p, 'theta_upper': theta, 'eta': display(eta), + 'eta_minus_theta_to_p': display((eta[0]-theta**p, eta[1]-theta**p)), + 'm_to_saving': display(base), 'H': H, 'N': '2^'+str(H), + 'integer_test': {'left_base': H+1, 'left_exponent': p, + 'right_base': 2, 'right_exponent': hi}, + 'grid_step': step, 'previous_grid_point_rejected': True, + 'smaller_logarithmic_power_rejected': True} + + +def power_majorant_comparison(v, uniform_saving): + """Retain #4416's older power proof, changing only the new unit's ranks.""" + t, z, h = 1-C, 1-uniform_saving, Q(1, 7) + z0 = (t+z)/2 + delta = z0-t + B, debt = (4+7*h)*v, 1+7*v*(1-z0) + ratio = (delta*B+debt)/(h*delta) + H0 = -((-ratio.numerator)//ratio.denominator) + ratio = H0*(1-z0)/(z-z0) + H1 = ratio.numerator//ratio.denominator+1 + need(H0 >= 7*v and H0*h*delta >= delta*B+debt, 'power majorant threshold') + need((H0-1)*h*delta < delta*B+debt, 'previous power threshold rejected') + need(H1*(z-z0) > H0*(1-z0) >= (H1-1)*(z-z0), + 'strict power-majorant comparison and previous-rank control') + return {'H0': H0, 'H1': H1, 'N': '2^'+str(H1), 'theta_upper': 1-h, + 'scope': 'Tail transformation alone, retaining the older power majorant.'} + + +def outer_ledger(uniform_saving): + d = (C-KAPPA)/7 + params = {'kappa': KAPPA, 'tested_saving': C, + 'complex_uniform_saving': uniform_saving, 'b': KAPPA+5*d, + 'a': KAPPA+4*d, 'q': KAPPA+3*d, 'bit_saving': Q('0.0027'), + 'epsilon': 1-d, 'beta': 1-3*d, 'r0': d/10, + 'stop': d, 'layout': d, 'd': d} + env = source_environment(HERE/'vendor/outer_endpoint.py') + row = env['ledger'](params) + need(len(row['strict_checks']) == 54 and len(row['functional_checks']) == 3, + 'complete first outer ledger') + need(all(v > 0 for group in ('strict_checks', 'functional_checks') + for v in row[group].values()), 'all outer predicates') + frozen = json.loads((HERE/'vendor/p7-RESULT.json').read_text())['endpoint']['outer'] + need(encoded(row) == frozen, 'unchanged full p7 endpoint ledger') + parsed = ast.parse((HERE/'vendor/check_ledger.py').read_bytes()) + function = next(n for n in parsed.body + if isinstance(n, ast.FunctionDef) and n.name == 'ledger') + constants = [n for n in parsed.body if isinstance(n, ast.Assign) + and any(isinstance(t, ast.Name) and t.id.startswith('KAPPA_') + for t in n.targets)] + eps, beta, q, a = (params[k] for k in ('epsilon', 'beta', 'q', 'a')) + grid = 10**10 + backoff = Q((eps*q*grid).__floor__(), grid)-KAPPA + need(backoff > 0, 'strict derived oracle grid backoff') + oracle = {'Q': Q, 'R0': params['r0'], 'ZETA': Q(1, 10**8), + 'SLACK': d, 'STOP': d, 'FLOOR': grid, 'BACKOFF': backoff, + 'EPS': eps, 'BETA': beta, 'THETA_POWER': Q(2), + 'HALO_POWER': 48, 'CORE_POWER': 128, 'STRASSEN_TAU': Q(45, 16), + 'b': params['b'], 'q': q, 'a': a, 'bit': params['bit_saving'], + 'online': Q('0.001730970419199163702738'), + 'old': Q('0.001730970419199163702738')} + code = ast.fix_missing_locations(ast.Module(body=constants+[function], type_ignores=[])) + exec(compile(code, 'pinned 63-predicate ledger', 'exec'), oracle) + second = oracle['ledger']('higher_moment_smaller_ranks') + need(second['kappa'] == KAPPA and second['margins'] == row['margins'], + 'all nine rows match both ledgers') + need(len(second['strict_checks']) == 63 and + all(v > 0 for v in second['strict_checks'].values()), 'all 63 legacy predicates') + controls = {} + for name, updates in [('closed_epsilon', {'epsilon': Q(1)}), + ('missing_layout', {'layout': Q(0)}), + ('unfunded_kappa', {'kappa': C}), + ('closed_uniform_gap', {'complex_uniform_saving': params['b']}), + ('insufficient_BIT', {'bit_saving': Q('0.0023')})]: + bad = env['ledger'](dict(params, **updates)) + failed = sorted(k for k, v in bad['strict_checks'].items() if v <= 0) + need(failed, 'outer control rejected: '+name) + controls[name] = failed + for name, options in [('old_per_axis_scan', {'old_scan': True}), + ('group_equals_dimension', {'beta_': eps})]: + bad = oracle['ledger']('reject_'+name, **options) + failed = sorted(k for k, v in bad['strict_checks'].items() if v <= 0) + need(failed, 'legacy control rejected: '+name) + controls[name] = failed + return {'ledger': row, 'legacy_63_checks': second['strict_checks'], + 'legacy_grid': grid, 'legacy_backoff': backoff, + 'minimum_margin_minus_kappa': min(row['margins'].values())-KAPPA, + 'rejected_controls': controls} + + +def finite_controls(): + def tensor(histogram): + out = Counter() + for k, n in histogram.items(): + for h, b in histogram.items(): + out[k*h] += n*b + return out + + def split(histogram, cutoff): + out = Counter() + for k, n in histogram.items(): + q, r = divmod(k, cutoff) + out[cutoff] += q*n + if r: + out[r] += n + return +out + + target, paid = tensor({2:1, 5:1}), tensor({1:2, 4:1}) + padded, completion = Counter(), Counter() + for k, n in target.items(): + padded[max(k, 9)] += n + if k < 9: + completion[9-k] += n + final = split(paid+completion, 4) + mass = lambda x: sum(k*n for k, n in x.items()) + need(mass(padded)-mass(final) == 7**2-6**2 == 13, 'exact paid padding mass') + need(min(padded) > max(final), 'exact toy separation') + need(final == Counter({1:5, 4:9}), 'literal toy expanded inventory') + # t=1/2, sigma=3/4, R=100, J=1 refutes a sublinear tail extension. + invalid = power(100, Q(1, 2))[1]+2*power(100, Q(3, 4))[1] + need(invalid < 100, 'sublinear upper-tail moment cannot bound splitting') + return {'toy_targets': padded, 'toy_paid': final, 'rank_one_surplus': 13, + 'sublinear_tail_counterexample': {'R': 100, 'J': 1, 't': '1/2', + 'sigma': '3/4', 'actual_charge': 100, + 'invalid_upper': display((invalid, invalid))}} + + +def verify(): + sources = authenticate() + invoice = invoice_oracle() + tail = tail_certificate() + rank = uniform_rank(tail['tensor_power']) + endpoint = outer_ledger(rank['uniform_saving']) + controls = finite_controls() + rejected = [] + for name, updates, expected in [ + ('too_short_product', {'v': 100}, 'complete charged normalized moment'), + ('sublinear_tail', {'u': C/2}, 'tail moment exponent at least one'), + ('lost_separation', {'floor': 10}, 'strict finite ranks'), + ]: + try: + tail_certificate(**updates) + except ValueError as error: + need(str(error) == expected, 'wrong rejection: '+name) + rejected.append({'mutation': name, 'failed_at': str(error)}) + else: + raise ValueError('accepted mutation: '+name) + old = json.loads((HERE/'vendor/p7-RESULT.json').read_text())['endpoint']['compiler'] + return encoded({'schema': 'higher-moment-native-strictification/1', + 'status': 'PASS_HIGHER_MOMENT_STRICTIFICATION', 'kappa': KAPPA, + 'invoice_oracle': invoice, 'strictification': tail, + 'uniform_rank': rank, 'outer': endpoint, + 'tail_only_power_majorant': power_majorant_comparison( + tail['tensor_power'], rank['uniform_saving']), + 'finite_controls': controls, 'rejected_mutations': rejected, + 'predecessor_H': old['H1'], + 'rank_exponent_reduction_factor': Q(old['H1'], rank['H']), + 'tensor_power_reduction_factor': Q(6240, tail['tensor_power']), + 'source_sha256': sources, + 'verifier_sha256': sha256(Path(__file__).read_bytes()).hexdigest(), + 'scope': 'Conditional charged transformation and finite compiler rank. Native all-column, physical, analytic, precision, storage, fixed-tape and recovery premises remain inherited. No new kappa, selected frontier or practical word.'}) + + +def main(): + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument('--out', type=Path) + args = parser.parse_args() + result = verify() + if args.out: + need(not args.out.exists(), 'new output path required') + args.out.write_text(json.dumps(result, indent=2, sort_keys=True)+'\n') + else: + need(json.loads((HERE/'RESULT.json').read_text()) == result, 'changed saved receipt') + print(json.dumps({'status': result['status'], 'tensor_power': result['strictification']['tensor_power'], + 'uniform_rank': result['uniform_rank']['N'], + 'strict_moment_gap': result['strictification']['strict_moment_gap'], + 'kappa': result['kappa']})) + + +if __name__ == '__main__': + main() diff --git a/research/central-q-decoder/verify.py b/research/central-q-decoder/verify.py new file mode 100644 index 0000000000..e40ecc0797 --- /dev/null +++ b/research/central-q-decoder/verify.py @@ -0,0 +1,30 @@ +"""Read-only verification of exact central-Q decoder and its real bill.""" +from pathlib import Path +from hashlib import sha256 +import json, subprocess, sys, secrets +ROOT=Path(__file__).resolve().parent + +def need(ok,msg): + if not ok:raise ValueError(msg) +def integrity(): + records=json.loads((ROOT/'MANIFEST.json').read_text(encoding='utf8'))['files'] + expected={r['path']:r for r in records} + actual={p.relative_to(ROOT).as_posix()for p in ROOT.rglob('*')if p.is_file()and '__pycache__'not in p.parts and p.suffix!='.pyc'}-{'MANIFEST.json'} + need(actual==set(expected),'Changed package inventory') + for name,r in expected.items(): + n=Path(name);need(not n.is_absolute()and '..'not in n.parts,'Unsafe path') + b=(ROOT/n).read_bytes();need(len(b)==r['size']and sha256(b).hexdigest()==r['sha256'],'Changed file: '+name) + return len(expected)+1 + +def main(): + count=integrity();saved=json.loads((ROOT/'RESULT.json').read_text(encoding='utf8'));checks=[] + for name in ['check_decoder.py','check_rounding.py','check_invoice.py']: + cache=ROOT/('.bytecode-'+secrets.token_hex(12));need(not cache.exists(),'Fresh bytecode namespace') + argv=[sys.executable,'-I','-B','-X','pycache_prefix='+str(cache)]+(['-O']if not __debug__ else[])+[str(ROOT/name)] + p=subprocess.run(argv,capture_output=True,timeout=90) + if p.returncode: + sys.stderr.buffer.write(p.stderr);raise RuntimeError('Failed scientific replay: '+name) + got=json.loads(p.stdout);need(got==saved[name],'Changed mathematical receipt: '+name) + checks.append({'component':name,'status':got['status']}) + print(json.dumps({'status':'PASS_CENTRAL_Q_DECODER','files':count,'optimized_wrapper':not __debug__,'checks':checks,'new_kappa':False},indent=2)) +if __name__=='__main__':main()