diff --git a/research/selected-centre-native-lift/README.md b/research/selected-centre-native-lift/README.md new file mode 100644 index 0000000000..98721e3eb4 --- /dev/null +++ b/research/selected-centre-native-lift/README.md @@ -0,0 +1,286 @@ +# Native rank lift for the first two selected centre cuts + +**Scoped proof with an exact finite certificate; no new κ or supplier.** +The sixteen centre-source rows in the selected time-0/time-1 forward calls +have joint complex rank **8,192 = 16 × 512** in the local native address model. +Their two scatter increments have the same rank. This closes the *local +native-frame lift* left open by [Adam Gall's PR1918](https://github.com/CrocSwap/integer-mult-bounds/pull/1918) +for this pair, using the repository's existing common-frame conjugation lemma. +It does not prove a lower bound of 128 on recursive rank mass. + +In particular, a replacement whose **entire source-dependent transcript** is +eight 512-dimensional complex rows cannot reconstruct both scatter increments +when it has no other source-dependent input. This is an information bound on +that specified linear interface. Eight reusable storage slots, additional +reads, larger rows, altered output obligations and arbitrary recursive calls +are different interfaces and are not excluded. + +## Exact object and new evidence + +Base: `c676548106012571fefa1dce0ec16f1bcfe11dce`. The selected PR1094 source is +`0fc329d0bec93ca7cd288eaea1295172e8789810`. The claim is in +[discussion #1884](https://github.com/CrocSwap/integer-mult-bounds/discussions/1884#discussioncomment-18930557). +The two complete calls have time/stage/replica `(0,0,0)` and `(1,0,8)`, both +forward and using the exact same selected `gauge44` emitted program. There +are 704 ordinary roles per call and 30 common physical owners; every common +owner is a helper in both calls. Neither call uses any of the other's active +source or target families. The union has 1,378 owners. + +PR1918 already supplies a rank-16 **scalar** minor and explicitly declines to +infer native rank. This package adds the missing factorization and checks its +hypotheses against the exact selected word: + +| Check | Result | +|---|---:| +| Complete forward events with extended labels | 24,767; zero violations | +| Ordinary scalar input columns, complete continuation | 704 | +| Used native child recipes, phase included | 2,888, each on all 512 columns | +| Source/target adapter identities | 224, each on all 512 columns | +| Invertible residual-wrapper records and their role bindings | 36 records; 480 events | +| Source-to-helper block at the complete endpoint | zero | +| Pivot-input block in targets before the centre phase | zero | +| Native source/scatter rank at both cuts | 8,192 | +| Literal native replay of one encoded input | all 24,767 events; 360,448 endpoint amplitudes | + +The scalar stream audit and rank application are implemented here. Exact +Clifford evaluation reuses the pinned independent kernel from +[Sagar Thakrar's selected-recipe audit](../frontier1094-recipes-exact-seed76/README.md). +Its recipe theorem is credited prior work; repeating those identities supplies +fresh evidence for this application's premise. The proof below, rather than +an 8,192-square Gaussian elimination, establishes the native rank. + +## 1. Common-frame factorization, including the continuation + +Write `T_f` for the invertible canonical operator of frame `f` on +`M = C^512`. Formulas use each call's admitted local chart; external row-wise +admission maps contribute additional invertible factors. An actual child from frame `a` to `b` applies +`T_b T_a^-1`. The checker decodes its serialized `L F_r R` and verifies + +``` +L F_r R T_a = T_b +``` + +on every basis column, including global phase. Every ADD combines rows at +the same frame. A relabel, scalar ADD/SCALE, private COPY or CLEAR consequently +preserves the invariant `physical_row = T_label × normalized_row`, where +the normalized rows follow the scalar word. This is +[`Stream.conj_matrix`](../e8-lemma-g-lean/LemmaG/Stream.lean), not a new general lemma. + +The invariant also covers the conversion boundaries. If the source-entry +monomial is `M_i`, the initial label operator is `M_i^-1 T_start(i)`. +For a helper with start/end `(a,b)` and serialized wrappers `R,L`, use initial +operator `R T_a` and final operator `L^-1 T_b`; its actual pre/post operations +are `R^-1` and `L^-1`. For a target whose exit operation is `N_i^-1`, its +post-label operator is `N_i^-1 T_final(i)`. Other identity adapters preserve +the canonical label. These definitions make each conversion a conjugation +between the stated label operators. The code checks every conversion's role, +phase, direction, frame and multiplicity, and rejects an ADD through a +noncanonical boundary label. All serialized monomials used here are invertible. +Early helper endpoints are included: this does not assume every helper ends +at the full frame. + +Hence the complete physical word has block form + +``` +D_final (S ⊗ I_M) D_initial^-1, +``` + +where both `D` matrices are invertible and block diagonal by role. Fresh +exact scalar replay gives `S: (x,y,h) -> (x,y+x,h)` on all 704 ordinary +columns, and every private centre is cleared. In particular, **the native +source-to-helper block is zero**, even though a helper's own state can advance +by a nonidentity operator. This distinction matters: helper restoration to +its original bits is not assumed. Initial helper and target dirt is arbitrary; +take differences between executions holding that dirt fixed. + +## 2. An explicit invertible native minor + +For each call, vary only source roles `J = (0,1,2,3,4,5,6,12)`. All other +initial rows are fixed. Let `u_j` be these eight physical source variations. +The source-adapter identities verified above give normalized initial values + +``` +x_j = C_qj^-1 u_j, +C_q = ((1+i)I + (1-i)X_q)/2. +``` + +Here the actual port masks are `(11,19,35,67,131,259,13,41)`. +Each `C_q` is invertible (`C_q^2 = X_q`); its forward/inverse product is also +checked on all 512 columns. The eight normalized carrier values at the centre +cut are `z = (P ⊗ I_M)x`, with + +``` +P = [ 1 0 1 0 0 0 0 1 + 1 1 1 1 1 1 1 0 + 1 1 0 0 0 0 1 1 + 1 0 0 1 1 1 0 0 + 0 -1 0 -1 0 0 1 1 + 0 0 0 0 -1 1 0 0 + 0 0 1 1 0 0 0 1 + 0 -1 -1 0 -1 -1 1 0 ], det(P) = 32. +``` + +Thus the actual eight carrier rows are +`diag(T_415,...,T_422) (P ⊗ I_M) diag(C_qj^-1) u`, an invertible +4,096-square map. The native centre descents remove the `T_415,...,T_422` +factors before the scatter, whose target frame is zero. + +Let `B` be the scalar scatter matrix restricted to target roles +`(112,113,115,116,117,118,120,131)`. The checker extracts it from the literal +centre events and finds + +``` +det(B) = -1/16384, det(BP) = -1/512. +``` + +The same eight target increments therefore have native matrix +`(BP ⊗ I_M) diag(C_qj^-1)`, also invertible. Exact matrices, both-sided +inverses and determinant witnesses are in [RESULT.json](RESULT.json). +Every target's variation is zero before the centre phase on this input +slice, so these increments are not supplied by pre-existing target data. + +## 3. Why the two noncoincident cuts still add + +The first complete call finishes before the second begins. Their only shared +owners are helpers. Section 1 proves that no variation of the first call's +source data survives in any helper at its endpoint. The second call therefore +has no dependence on those first eight pivot inputs. Conversely, the first +call never touches the second call's pivot source families. The sixteen +physical pivot owner IDs are precisely PR1918's + +``` +0,1,2,3,4,5,6,12, 7168,7169,7170,7171,7172,7173,7174,7180. +``` + +The two-cut minor is block diagonal with two invertible blocks from section 2, +giving rank `2 × 4096 = 8192`. This also is the maximum possible rank of sixteen +carrier rows. The full 176-row scatter history factors through those sixteen +rows and contains the displayed invertible output minor, so its rank is +exactly 8,192 as well. This is a pair of chronological observations, not a +claim that the sixteen carrier rows exist simultaneously. + +The local native statement retains all 512 addresses. For its interpretation +in the selected hosted model, we use the **inherited injective chart/cover +contract**: the template identifies both windows as the first nine axes with +empty prefix, all data routes have stage zero, and `rho_0,q = I`. Distinct +data owner families give independent row variables. Complete call sweeps and +block-diagonal helper endpoints allow arbitrary shared helper dirt. Row-wise +invertible chart changes and a common spectator tensor factor preserve the +factorization and its zero cross blocks. No equality between the two calls' +helper charts or offsets is assumed. We check the selected owner/window/route +records, but do **not** independently reprove or replay the global 73-axis +hosting compiler. The global interpretation remains conditional on that +existing contract; the local operator calculation does not. + +## Transcript consequence and its limits + +Suppose a linear replacement receives the two scatter outputs' source +information solely through a transcript `E u` consisting of `d` complex +scalars; it has no other source-dependent state or observations on the above +input slice. Correctness would imply `F = R E`, where `F` is the demanded +scatter-history map. Therefore `d >= rank(F) = 8192`. Eight rows of dimension +512 have only 4,096 dimensions and cannot suffice. This also excludes nonlinear +decoding of a *linear* transcript, since any kernel collision of `E` must be a +kernel collision of `F`. No nonlinear-encoding claim is made. +The observation contract must retain both scatter increments. A replacement +that only preserves the final call endpoints may change these internal +observations and is outside this exclusion. + +A concrete native collision for naive pooling is obtained by choosing any +nonzero `v in M`, setting normalized centre values to `e_0 v` in the first +call and `-e_0 v` in the second, and choosing physical pivot inputs +`u_j = C_qj (P^-1)_(j,0) v` with opposite signs between calls. Corresponding +native carriers have the same frame in their respective local charts, so +their pairwise sums in those coordinates vanish. Their +separate scatter increments are nonzero. This is PR1918's scalar collision +with the previously missing native input twists supplied. + +The source-only condition is essential. Other helpers can contain source +information *at the centre cut*, even though the complete endpoint removes it. +A replacement that reads them has an additional transcript. Sequential reuse +of eight registers can convey sixteen rows and is not excluded either. No +conversion from complex information dimension to a minimum number/rank of +recursive calls is established. The unchanged two-phase bill is 16 rank-eight +transports, 16 COPYs, 32 CLEARs and 352 ADDs, with transport rank mass 128. +This proof does not certify that bill optimal. There is no changed profile to +screen with `ceiling.ceiling`; the card's ideal 1.90× shared-centre relaxation +was only the entry planning control. + +## Reproduce and verification scope + +Python 3.12, standard library only: + +```sh +python3 -I -B research/selected-centre-native-lift/verify.py +python3 scripts/research_package.py --package research/selected-centre-native-lift +``` + +Expected: + +```text +PASS_SELECTED_CENTRE_NATIVE_LIFT source_rank=8192 scatter_rank=8192 children=2888 columns=512 controls=11 no_new_kappa +``` + +Normal replay is read-only; `--write-result NEW_PATH` creates an absent receipt +exclusively. Source hashes are checked before importing the Clifford kernel. +Archive members are named by full path, not basename. The eleven semantic +controls cover an omitted climb, wrong common frame, omitted cleanup gate, +omitted private clear, shared source owner, intervening bridge, repeated pivot column, wrong child +phase, wrong source port, loss under pooling and a wrong descent phase in the +literal native executor. Checks remain active under +`-O`. The exact packed evaluator's radix is chosen from its proved bound on +the number of Fourier gates; it uses integers, not floating-point arithmetic. + +[native_probe.py](native_probe.py) separately interprets every emitted event +on unpacked Gaussian-dyadic vectors for the explicit encoded input +`u_j = C_qj (P^-1)_(j,0) e_0`. It uses a new evaluator for the serialized +monomials, their inverses and the square-root translations. It compares all +4,096 carrier amplitudes, 57,344 target amplitudes at the scatter cut, and +360,448 ordinary amplitudes at the complete endpoint, including zero helper +response and private erasure. A corrupted descent phase fails at the scatter +cut even though the scalar shadow is unchanged. This is one engineered +input and a semantic integration control, not a substitute for the all-input +conjugation proof. The three unit-test groups additionally use an independent +permutation-sum determinant oracle and check relocated inputs, corrupted +archives and rejection of a changed kernel before it can execute. + +The existing conjugation lemma is read and pinned; Lean was not run. No full +supplier cold replay, compiler/tape integration, precision proof, all-size +theorem, independent human review or outer-transfer proof is claimed. The +36 residual-wrapper coordinate-factor/tariff identities are not reverified: +their invertibility and role-local action suffice for this rank application. +The selected record and frozen source packages are unchanged. + +## Open next questions + +1. **A priced interface with additional reads or sequential reuse.** Such an + interface could evade this transcript bound and still reduce recursive + centre work. Start with one explicit two-call word and enumerate every + source-dependent read, frame change, restoration and hosting charge. The + blocker is the absent implementation and invoice, not the rank lemma. +2. **A pair with dependent chronological sources.** A different pair with + intersecting active data could permit a smaller joint rank. First identify + that pair and compose every intervening call in normalized coordinates. + The present disjoint-data proof does not apply automatically. Full chart + and chronological binding is the blocker. Structured questions are in + [TASK.json](TASK.json). + +## Credit and provenance + +Adam Gall's PR1918 (`cc43a233ad989e717c8d46c6398ee50f97f5c0b9`) supplies the +specific pair, scalar minor and open question. DreamingOfClouds and the +PR484/509 Lemma G lineage supply the common-frame theorem, with their original +Claude assistance notices retained. Sagar Thakrar supplies the independent +Clifford kernel and selected recipe audit; this account's PR1415 and +BigCactusLabs' PR702 are among that kernel's calibrations. The construction +and source retain Rohan Arun, Jeremy Kothe, Hao Yan, icekylinx, Zhihao Chen, +Chafik Boukhalfa, DreamingOfClouds and the earlier credited lineage. + +Related work: PR1829/Discussion1963 concern owner identity; PR1664/1684 give +conditional transport-height arguments; PR1708/1748 assume shared post-A +values; PR1969/1981 concern joint-query coding and source restoration. None of +those results is claimed anew. Exact live inputs, Git blobs and source hashes +are in [SOURCES.json](SOURCES.json); no pending implementation is imported. + +Prepared for commdata2338 (@commdata2338), with substantial OpenAI Codex assistance. +New work is Apache-2.0; predecessor sources and notices remain unchanged. diff --git a/research/selected-centre-native-lift/RESULT.json b/research/selected-centre-native-lift/RESULT.json new file mode 100644 index 0000000000..5359788b9b --- /dev/null +++ b/research/selected-centre-native-lift/RESULT.json @@ -0,0 +1,638 @@ +{ + "centre_frames": [ + 415, + 416, + 417, + 418, + 419, + 420, + 421, + 422 + ], + "controls": [ + "omitted_climb", + "wrong_common_frame", + "omitted_cleanup_gate", + "omitted_private_clear", + "shared_source_owner", + "intervening_bridge", + "duplicate_pivot_column", + "wrong_child_global_phase", + "wrong_source_port", + "pooled_totals_lose_nonzero_scatter", + "literal_native_descent_phase" + ], + "conversion_events": 1570, + "eight_row_transcript_dimension": 4096, + "events": 24767, + "extended_label_violations": 0, + "literal_native_probe": { + "centre_values_checked": 4096, + "engine": "unpacked Gaussian-dyadic literal stream", + "events": 24767, + "inputs": "one encoded centre-basis vector, v=address basis0; every other input zero", + "ordinary_endpoint_amplitudes": 360448, + "private_exit": "zero", + "scatter_values_checked": 57344, + "source_sha256": "870bff1b47cd712130e2228619b00998058b753f98b854d3a8bae0e909788d1c", + "source_to_helper_response": "zero" + }, + "native_operator_checks": { + "endpoint_adapter_identities": 224, + "input_twist_inverses": 8, + "invertible_wrapper_records": 36, + "operator_columns": 512, + "used_child_keys_sha256": "dd14204a1dda79b5fb7e5853519d5e19940513777f674464a36c68b9dd34212c", + "used_child_recipes": 2888 + }, + "native_output_coefficient_det": "-1/512", + "native_output_coefficient_inverse": [ + [ + "3", + "-3", + "2", + "2", + "-1", + "0", + "-2", + "-2" + ], + [ + "-1", + "-1", + "0", + "0", + "-1", + "2", + "0", + "0" + ], + [ + "2", + "0", + "0", + "0", + "0", + "-2", + "2", + "0" + ], + [ + "-1", + "1", + "-2", + "0", + "1", + "0", + "0", + "0" + ], + [ + "-1", + "1", + "0", + "-2", + "1", + "0", + "0", + "0" + ], + [ + "-1", + "1", + "0", + "0", + "1", + "0", + "0", + "2" + ], + [ + "-1", + "1", + "0", + "0", + "1", + "0", + "2", + "0" + ], + [ + "-1", + "3", + "-2", + "-2", + "-1", + "2", + "-2", + "2" + ] + ], + "native_output_coefficient_minor": [ + [ + "1/2", + "1/4", + "1/2", + "1/4", + "1/4", + "1/4", + "1/4", + "1/4" + ], + [ + "0", + "-1/2", + "-1/4", + "-1/4", + "-1/4", + "-1/4", + "1/2", + "1/4" + ], + [ + "0", + "-1/4", + "-1/4", + "-1/2", + "0", + "0", + "1/4", + "0" + ], + [ + "0", + "-1/4", + "-1/4", + "0", + "-1/2", + "0", + "1/4", + "0" + ], + [ + "1/2", + "1/4", + "1/4", + "1/2", + "1/2", + "1/2", + "1/4", + "0" + ], + [ + "1/2", + "1/2", + "1/4", + "1/4", + "1/4", + "1/4", + "1/2", + "1/4" + ], + [ + "0", + "1/4", + "1/4", + "0", + "0", + "0", + "1/4", + "0" + ], + [ + "0", + "1/4", + "1/4", + "0", + "0", + "1/2", + "-1/4", + "0" + ] + ], + "native_scatter_history_rank": 8192, + "native_source_rank_per_call": 4096, + "native_source_rank_two_cuts": 8192, + "ordinary_scalar_columns": 704, + "pivot_input_owners": [ + 0, + 1, + 2, + 3, + 4, + 5, + 6, + 12, + 7168, + 7169, + 7170, + 7171, + 7172, + 7173, + 7174, + 7180 + ], + "replicas": [ + 0, + 8 + ], + "scatter_minor": [ + [ + "1/4", + "1/4", + "0", + "0", + "0", + "0", + "0", + "0" + ], + [ + "0", + "0", + "0", + "0", + "1/4", + "0", + "0", + "1/4" + ], + [ + "0", + "0", + "0", + "0", + "1/4", + "0", + "-1/4", + "0" + ], + [ + "0", + "0", + "0", + "0", + "0", + "1/4", + "0", + "1/4" + ], + [ + "0", + "1/4", + "0", + "1/4", + "0", + "0", + "0", + "0" + ], + [ + "0", + "1/4", + "1/4", + "0", + "0", + "0", + "0", + "0" + ], + [ + "0", + "1/4", + "0", + "-1/4", + "0", + "0", + "0", + "0" + ], + [ + "0", + "0", + "0", + "0", + "0", + "1/4", + "0", + "-1/4" + ] + ], + "scatter_minor_det": "-1/16384", + "scatter_minor_inverse": [ + [ + "4", + "0", + "0", + "0", + "-2", + "0", + "-2", + "0" + ], + [ + "0", + "0", + "0", + "0", + "2", + "0", + "2", + "0" + ], + [ + "0", + "0", + "0", + "0", + "-2", + "4", + "-2", + "0" + ], + [ + "0", + "0", + "0", + "0", + "2", + "0", + "-2", + "0" + ], + [ + "0", + "4", + "0", + "-2", + "0", + "0", + "0", + "2" + ], + [ + "0", + "0", + "0", + "2", + "0", + "0", + "0", + "2" + ], + [ + "0", + "4", + "-4", + "-2", + "0", + "0", + "0", + "2" + ], + [ + "0", + "0", + "0", + "2", + "0", + "0", + "0", + "-2" + ] + ], + "scatter_minor_target_roles": [ + 112, + 113, + 115, + 116, + 117, + 118, + 120, + 131 + ], + "scope": "Exact 512-address local native rank and conditional source-only transcript exclusion; no recursive-call minimum or supplier gain.", + "shared_data_owners": 0, + "shared_helper_owners": [ + 1127, + 1128, + 1129, + 1130, + 1131, + 1132, + 1133, + 1134, + 1135, + 1136, + 1137, + 1138, + 1139, + 1140, + 1141, + 1142, + 1143, + 1144, + 1145, + 1146, + 1147, + 1148, + 1149, + 1150, + 1151, + 1152, + 1153, + 1154, + 1155, + 1156 + ], + "source_minor": [ + [ + "1", + "0", + "1", + "0", + "0", + "0", + "0", + "1" + ], + [ + "1", + "1", + "1", + "1", + "1", + "1", + "1", + "0" + ], + [ + "1", + "1", + "0", + "0", + "0", + "0", + "1", + "1" + ], + [ + "1", + "0", + "0", + "1", + "1", + "1", + "0", + "0" + ], + [ + "0", + "-1", + "0", + "-1", + "0", + "0", + "1", + "1" + ], + [ + "0", + "0", + "0", + "0", + "-1", + "1", + "0", + "0" + ], + [ + "0", + "0", + "1", + "1", + "0", + "0", + "0", + "1" + ], + [ + "0", + "-1", + "-1", + "0", + "-1", + "-1", + "1", + "0" + ] + ], + "source_minor_det": "32", + "source_minor_inverse": [ + [ + "3/4", + "0", + "0", + "1/4", + "-1/4", + "0", + "-1/2", + "1/4" + ], + [ + "-1/4", + "0", + "1/2", + "-1/4", + "-1/4", + "0", + "0", + "-1/4" + ], + [ + "1/2", + "1/2", + "-1/2", + "-1/2", + "0", + "0", + "0", + "0" + ], + [ + "-1/4", + "0", + "0", + "1/4", + "-1/4", + "0", + "1/2", + "1/4" + ], + [ + "-1/4", + "0", + "0", + "1/4", + "1/4", + "-1/2", + "0", + "-1/4" + ], + [ + "-1/4", + "0", + "0", + "1/4", + "1/4", + "1/2", + "0", + "-1/4" + ], + [ + "-1/4", + "1/2", + "0", + "-1/4", + "1/4", + "0", + "0", + "1/4" + ], + [ + "-1/4", + "-1/2", + "1/2", + "1/4", + "1/4", + "0", + "1/2", + "-1/4" + ] + ], + "source_port_twists": [ + 11, + 19, + 35, + 67, + 131, + 259, + 13, + 41 + ], + "source_to_helper_endpoint_block": "zero", + "stage": 0, + "status": "PASS_SELECTED_CENTRE_NATIVE_LIFT", + "target_pivot_block_at_centre_entry": "zero", + "times": [ + 0, + 1 + ], + "unchanged_transport_rank_mass": 128, + "unchanged_two_phase_bill": { + "add": 352, + "clear": 32, + "copy": 16, + "rank8": 16 + } +} diff --git a/research/selected-centre-native-lift/SOURCES.json b/research/selected-centre-native-lift/SOURCES.json new file mode 100644 index 0000000000..9982dc39c8 --- /dev/null +++ b/research/selected-centre-native-lift/SOURCES.json @@ -0,0 +1,88 @@ +{ + "schema_version": 1, + "base_commit": "c676548106012571fefa1dce0ec16f1bcfe11dce", + "files": [ + { + "path": "certificates/selected-result.json", + "usage": "provenance", + "git_blob": "ae6a99f28aa468649eb66a361e764d769363bf11", + "sha256": "10b9e340fd8e354a37a0c4813c90e5de1dd42044b5f6aca4a3fc5a42b685fa32" + }, + { + "path": "docs/research/agent-task-catalog.json", + "usage": "provenance", + "git_blob": "06c96f5579bb67ed1b86d334e78fbed7da6945f1", + "sha256": "6686ad58f1fbdbc87134a78901b60fd53a20d3984355e91defbbebc9e9fa8075" + }, + { + "path": "research/community-frontier1094-audit/selected-replay.tar.gz", + "usage": "input", + "git_blob": "c24daf067f9c543421d89ca2eeaa4eb78a57fb6f", + "sha256": "f1da80610bf33c58527f18ad63b4350d0b864e1d4486141ee17ac9bed4d529d6" + }, + { + "path": "research/e8-lemma-g-lean/LemmaG/Stream.lean", + "usage": "input", + "git_blob": "e89897190307a6f3fcfb858f8de00cc5a7f49b3e", + "sha256": "7138f4b859d0574a803e99401f05ef5e0ec9eeac0eb480775cd9b86595c365f8" + }, + { + "path": "research/e8-lemma-g-lean/PROOF.md", + "usage": "input", + "git_blob": "6b24da0ab861902a6a3f65d9599bb9c0f964aa1c", + "sha256": "2a7d84a83d34495dcf46ff9241ee3d7ec18ffc7d49c5476ab15fe0834046f2a3" + }, + { + "path": "research/frontier1094-recipes-exact-seed76/README.md", + "usage": "input", + "git_blob": "4a4747e0c302e58cc8f4c5516d57dc8b81ce95d0", + "sha256": "a0635fd335cf2949a00f6a1eee8826188efbccd3051d4cc26dd8cee2fe725ce8" + }, + { + "path": "research/frontier1094-recipes-exact-seed76/clifford.py", + "usage": "input", + "git_blob": "6f1e6a38febde7eb7a7341d317522e6650d84408", + "sha256": "d5e42ddabd141b7bfbd70fe13908f3c3a06aeccebeab90623596bfb1988b97fb" + }, + { + "path": "research/selected-centre-composed-source-rank/README.md", + "usage": "input", + "git_blob": "0e3c819eb2e75bd5f064cceaf79199688cfff46c", + "sha256": "d22cc44ede318c6c0d07c86d7ad4b4de8d4f3aa54625c4cf0561c28ca53fbd80" + }, + { + "path": "research/selected-centre-composed-source-rank/RESULT.json", + "usage": "input", + "git_blob": "e53349fed1d300aaddd28c36aaa28f5c7ed96c77", + "sha256": "31555505a5eea8e54b3b04c67e4aefa495101f3b43d7fe9fa8dca90776dea668" + }, + { + "path": "research/split-centres-global/proofs/INHERITED-COMPLEX-GEOMETRY.txt", + "usage": "input", + "git_blob": "c4150cb693414c098690eae79b3aea5f47c184ff", + "sha256": "c1ff55536594222a8d2a30bc0e0956959774e1be2d5420b7838ad553ee556df2" + } + ], + "archive_members": { + "word": { + "path": "candidate/strict/global/base/providers/gauge44/CANONICAL-WORD.json.gz", + "sha256": "16bc0ebb04b4be6c0ade74badc6a0c0cdba4215eda86e4ff9f13abf8ecebd219" + }, + "programs": { + "path": "candidate/strict/global/base/providers/gauge44/LOCAL-PROGRAMS.json.gz", + "sha256": "241fde27d4e43f5a9cb6b128f9f76c5131a53d09f0371676163f914d0b0fef3a" + }, + "recipes": { + "path": "candidate/strict/global/base/providers/gauge44/CLIFFORD-RECIPES.json", + "sha256": "d0768f2164d5f64a2fdbec422f1cfde4e400818792f1904ca541958377243731" + }, + "residuals": { + "path": "candidate/strict/global/base/providers/gauge44/RESIDUAL-ADAPTERS.json", + "sha256": "383f40aadd00a4ac700dfd0d4c22d6c6c0be9a9863116e4d69c7acd23bafae0c" + }, + "template": { + "path": "candidate/strict/global/hosted/GLOBAL-TEMPLATE.json.gz", + "sha256": "2acf02b418078e37090495c601fe550448751d4f35912757b13a1f778efc7760" + } + } +} diff --git a/research/selected-centre-native-lift/TASK.json b/research/selected-centre-native-lift/TASK.json new file mode 100644 index 0000000000..c3d5146695 --- /dev/null +++ b/research/selected-centre-native-lift/TASK.json @@ -0,0 +1,105 @@ +{ + "schema_version": 1, + "task_id": "centre-path-sharing", + "priority_revision": 3, + "base_commit": "c676548106012571fefa1dce0ec16f1bcfe11dce", + "original_card": { + "id": "centre-path-sharing", + "question": "Can the 64-per-call centre path (eight rank-8 COPY/ERASE totals through the private temporary) be shared across calls or shrunk?", + "starting_points": [ + "research/complex-local-word-ceiling/README.md", + "research/split-centres-global/proofs/PR386-BIT-GEOMETRY.txt", + "certificates/selected-result.json" + ], + "methods": [ + "Derive a fully charged favorable relaxation for sharing one centre path across k calls, including restoration, hosting and precision.", + "Prove a lower bound on copied information per call for the selected decoder contract." + ], + "acceptance_gate": "Show the changed centre charge and copy profile per call with every added restoration or hosting cost charged, and its ceiling via ceiling.ceiling(centre=...).", + "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": "Write the per-call centre charge and copy children for sharing across k = 2 calls, charge the sharing overhead, and screen it; stop this route if even the ideal sharing gains under 10%. Ideal budgets: free 2.80x, shared by two 1.90x (levers.py).", + "bottleneck_link": "The centre path consumes 64 of about 99.6 unpaid coordinates per call, i.e. about 64% of the raw deficit.", + "allowed_variations": [ + "One sharing pattern across a fixed number of calls.", + "One reduced copied-total contract for the existing decoder.", + "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": [ + "Removing copies without a replacement contract for the decoder's copied totals." + ], + "overlap_terms": [ + "centre path", + "copied totals", + "private temporary", + "shared centre", + "batching" + ] + }, + "scope_status": "refined", + "actual_scope": "Native 512-address source and scatter-history rank at selected time0/time1 stage0 forward calls, replicas0/8. Exact source-data minor, common-frame recipe identities, full first-call source-to-helper zero block, and an eight-row source-only transcript exclusion.", + "scope_change_reason": "Apply the existing common-frame conjugation lemma to the exact two cuts left open by PR1918, validating its hypotheses on the selected emitted word. This changes no centre implementation or tariff and supplies a scoped information bound, not a construction satisfying the card's cost-improvement gate.", + "bottleneck_link": "Tests whether the proposed two-call sharing may compress the selected independent source totals to eight same-width rows. The result applies only to a factor-through-transcript contract and does not bound general recursive child rank mass.", + "budget_minutes": 60, + "stop_rule": "Stop after the fixed two-call native factorization and its exact source bindings and controls. Do not expand to other pairs or infer a general centre-path lower bound.", + "outcome": "completed", + "evidence": "README.md scoped proof; RESULT.json exact minors, native recipe checks and literal encoded-input probe; verify.py plus eleven semantic controls and three independent/integrity test groups.", + "author": "commdata2338", + "ai_assistance": "Substantial OpenAI Codex assistance in mathematical derivation, source inspection, implementation, verification and exposition. No independent human review or new Lean proof.", + "open_questions": [ + { + "question": "Can a priced centre-sharing interface exploit additional source-dependent reads or sequential transcript reuse?", + "why_it_matters": "These mechanisms fall outside the simultaneous eight-row transcript excluded here and may still change the paid centre charge.", + "first_step": "Write one concrete two-call replacement specifying every source-dependent observation and its complete recursive, frame, restoration and hosting bill.", + "blocked_by": "No such changed interface is instantiated; ambient information dimension does not determine recursive rank tariffs." + }, + { + "question": "Does a distinct selected call pair have a deficient joint native source rank?", + "why_it_matters": "The present proof only excludes source-only compression for the first two calls with disjoint active data panels.", + "first_step": "Find a pair with intersecting active data and derive its complete chronological normalized source maps before attempting a minor lift.", + "blocked_by": "Intermediate calls and owner/chart overlap must be composed; this proof does not apply automatically." + } + ], + "seed": "a78997559db360e2da01645d31115561", + "track": "recursive-interfaces", + "scope_key": "a55534776f5479f1686c", + "refined_scope_key": "PR1918-time0-time1/native-frame-lift/16-source-minor/512-addresses", + "predecessors": [ + { + "pr": 1918, + "author": "Adam Gall", + "head": "cc43a233ad989e717c8d46c6398ee50f97f5c0b9", + "scope": "Scalar source minor and explicit native-lift handoff." + }, + { + "pr": 1094, + "author": "Rohan Arun", + "head": "0fc329d0bec93ca7cd288eaea1295172e8789810", + "scope": "Selected source construction and owner placement." + }, + { + "pr": 1829, + "head": "e150e7ed8fa33f0be769926535eeacd076c6bd13", + "scope": "Adjacent owner/chart identity context; no pending dependency." + } + ], + "method": "Exact rational row replay and invertible minor witnesses, all-column Gaussian-dyadic child checks using a pinned independent Clifford kernel, and a written application of the existing common-frame lemma.", + "bounded_domain": "Exactly two selected forward calls and the first full continuation; 704 ordinary scalar inputs, 16 pivot data owners, 512 address coordinates, all used forward child recipes.", + "optimistic_budget": "Ideal sharing of two complete centre paths has the repository relaxation multiplier 1.90, before overhead. No sharing construction is supplied: the actual two-phase bill stays16 rank8,16 COPY,32 CLEAR,352 ADD,rank mass128.", + "discussion": "https://github.com/CrocSwap/integer-mult-bounds/discussions/1884#discussioncomment-18930557", + "unchecked_obligations": [ + "No general lower bound on recursive invocation count or paid rank mass.", + "No changed supplier, new kappa or complete selected cold replay.", + "No independent global73-axis hosting/cover compiler replay, all-size theorem, precision, tape or outer-transfer proof.", + "Residual wrapper coordinate-factor identities are not reverified; only their invertibility and exact role bindings are needed here.", + "The existing Lean conjugation source is cited and pinned but Lean is not executed." + ] +} diff --git a/research/selected-centre-native-lift/VERIFY.json b/research/selected-centre-native-lift/VERIFY.json new file mode 100644 index 0000000000..1a0932f077 --- /dev/null +++ b/research/selected-centre-native-lift/VERIFY.json @@ -0,0 +1,44 @@ +{ + "schema_version": 1, + "status": "ready", + "python": "3.12", + "requirements": [], + "inputs": [ + "research/community-frontier1094-audit/selected-replay.tar.gz", + "research/e8-lemma-g-lean/LemmaG/Stream.lean", + "research/e8-lemma-g-lean/PROOF.md", + "research/frontier1094-recipes-exact-seed76/README.md", + "research/frontier1094-recipes-exact-seed76/clifford.py", + "research/selected-centre-composed-source-rank/README.md", + "research/selected-centre-composed-source-rank/RESULT.json", + "research/split-centres-global/proofs/INHERITED-COMPLEX-GEOMETRY.txt" + ], + "commands": [ + { + "argv": [ + "{python}", + "-I", + "-B", + "{package}/verify.py" + ], + "timeout_seconds": 180, + "checks": "Complete extended-label and 704-column scalar replay, exact native recipes on 512 columns, invertible source/scatter minors, literal native encoded-input replay and eleven semantic controls." + }, + { + "argv": [ + "{python}", + "-I", + "-B", + "-m", + "unittest", + "discover", + "-s", + "{package}", + "-p", + "test_verify.py" + ], + "timeout_seconds": 60, + "checks": "Independent permutation determinant oracle, valid relocation, archive corruption and kernel corruption before import." + } + ] +} diff --git a/research/selected-centre-native-lift/native_probe.py b/research/selected-centre-native-lift/native_probe.py new file mode 100644 index 0000000000..165c7139dc --- /dev/null +++ b/research/selected-centre-native-lift/native_probe.py @@ -0,0 +1,209 @@ +"""Literal native stream probe using unpacked Gaussian-dyadic statevectors. + +This is one exact engineered input, not an all-input native replay. The rank +proof uses the all-column recipe checks and conjugation lemma in verify.py. +Prepared for commdata2338 with substantial OpenAI Codex assistance. Apache-2.0. +""" +from fractions import Fraction +import hashlib +import json + +DIM = 512 +ZERO = ((), (), 0) + + +def need(ok, message): + if not ok: + raise ValueError(message) + + +def reduced(re, im, exponent): + bits = 0 + for x in re: + bits |= abs(x) + for x in im: + bits |= abs(x) + if bits == 0: + return ZERO + shift = min(exponent, (bits & -bits).bit_length()-1) + if shift: + re = [x >> shift for x in re] + im = [x >> shift for x in im] + return tuple(re), tuple(im), exponent-shift + + +def scale(vec, q): + q = Fraction(q) + need(q.denominator & (q.denominator-1) == 0, "dyadic coefficient") + if not vec[0] or not q: + return ZERO + return reduced([q.numerator*x for x in vec[0]], [q.numerator*x for x in vec[1]], + vec[2]+q.denominator.bit_length()-1) + + +def add(a, b, q): + b = scale(b, q) + if not b[0]: + return a + if not a[0]: + return b + e = max(a[2], b[2]) + return reduced([(x << (e-a[2]))+(y << (e-b[2])) for x, y in zip(a[0], b[0])], + [(x << (e-a[2]))+(y << (e-b[2])) for x, y in zip(a[1], b[1])], e) + + +def translate_root(vec, q, sign=1): + if not vec[0]: + return vec + a, b, e = vec + need(sign in (-1, 1), "root orientation") + re = [a[x]-sign*b[x]+a[x ^ q]+sign*b[x ^ q] for x in range(DIM)] + im = [b[x]+sign*a[x]+b[x ^ q]-sign*a[x ^ q] for x in range(DIM)] + return reduced(re, im, e+1) + + +def fourier(vec, rank): + for j in range(rank): + vec = translate_root(vec, 1 << j) + return vec + + +def phase(a, b, p): + return ((a, b), (-b, a), (-a, -b), (b, -a))[p % 4] + + +def apply_table(vec, table): + if not vec[0]: + return vec + re, im = [0]*DIM, [0]*DIM + for x, (y, p) in enumerate(table): + re[y], im[y] = phase(vec[0][x], vec[1][x], p) + return tuple(re), tuple(im), vec[2] + + +def monomial_table(rec, inverse=False): + table = [] + for x in range(DIM): + y = sum(((row & x).bit_count() % 2) << i for i, row in enumerate(rec["matrix_rows"])) + p = rec["phase"] + sum(a for i, a in enumerate(rec["linear_Z4"]) if x >> i & 1) + p += 2*sum((rec["quadratic_rows"][i] >> j) & 1 for i in range(9) + for j in range(i+1, 9) if (x >> i & 1) and (x >> j & 1)) + table.append((y ^ rec["offset"], p % 4)) + need(len({y for y, _ in table}) == DIM, "probe monomial invertibility") + if inverse: + answer = [None]*DIM + for x, (y, p) in enumerate(table): + answer[y] = (x, -p % 4) + return answer + return table + + +def circuit(vec, gates): + """Independent statevector semantics for the expected canonical centre.""" + for gate in gates: + tag = gate[0] + if tag == "C": + vec = translate_root(vec, gate[1], gate[2]) + elif tag == "P": + table = [(sum(((r & x).bit_count() % 2) << i for i, r in enumerate(gate[1])), 0) + for x in range(DIM)] + vec = apply_table(vec, table) + elif tag == "D": + Q, linear = gate[1:] + table = [] + for x in range(DIM): + p = sum(a for i, a in enumerate(linear) if x >> i & 1) + p += 2*sum((Q[i] >> j) & 1 for i in range(9) for j in range(i+1, 9) + if (x >> i & 1) and (x >> j & 1)) + table.append((x, p % 4)) + vec = apply_table(vec, table) + elif tag == "X": + vec = apply_table(vec, [(x ^ gate[1], 0) for x in range(DIM)]) + elif tag == "PH": + vec = apply_table(vec, [(x, gate[1]) for x in range(DIM)]) + else: + raise ValueError("probe gate") + return vec + + +def probe(word, events, recipes, residuals, pivots, pinv, scatter, target_ids, C): + basis = (tuple([1]+[0]*(DIM-1)), tuple([0]*DIM), 0) + normalized = {j: scale(basis, pinv[k][0]) for k, j in enumerate(pivots)} + rows = {("L", i): ZERO for i in range(704)} + for j in pivots: + rows["L", j] = translate_root(normalized[j], word["ports"][j]) + source_hash = hashlib.sha256(json.dumps([rows["L", j] for j in pivots]).encode()).hexdigest() + children = {(r["old"], r["new"]): r for r in recipes["children"]} + adapters = {(r["role"], r["port"]): r for r in recipes["endpoint_adapters"]} + tables = {} + + def monomial(vec, rec, inverse=False): + if not vec[0]: + return vec + key = (json.dumps(rec, sort_keys=True), inverse) + if key not in tables: + tables[key] = monomial_table(rec, inverse) + return apply_table(vec, tables[key]) + + def child(vec, a, b): + rec = children[a, b] + return monomial(fourier(monomial(vec, rec["right"]), rec["rank"]), rec["left"]) + + for event in events: + tag = event[0] + if tag == "phase": + if event[1] == "centers": + for k, carrier in enumerate(word["centers"]): + expected = circuit(basis, C.canonical_frame(word["frames"][word["center_frames"][k]])) if k == 0 else ZERO + need(rows["L", carrier] == expected, "direct native centre input") + need(all(rows["L", i] == ZERO for i in range(112, 224)), "direct target pre-cut") + if event[1] == "B": + expected = {i: scale(basis, row[0]) for i, row in zip(target_ids, scatter)} + need(all(rows["L", i] == expected.get(i, ZERO) for i in range(112, 224)), + "direct native scatter") + elif tag == "climb": + _, _, r, a, b, _ = event + rows["L", r] = child(rows["L", r], a, b) + elif tag == "center": + _, k, a, b, _ = event + rows["C", k] = child(rows["C", k], a, b) + elif tag == "adapter": + _, direction, r, _ = event + if direction == "old_to_new" and r < 112: + rows["L", r] = monomial(rows["L", r], adapters["source", r]["left"]) + elif direction == "new_to_old" and 112 <= r < 224: + rows["L", r] = monomial(rows["L", r], adapters["target", r-112]["left"], True) + elif tag == "residual_adapter": + direction, r, a = event[1:4] + b = event[4] if len(event) == 5 else 1 + rec = residuals["recipes"][str(a) if b == 1 else f"{a}:{b}"] + rows["L", r] = monomial(rows["L", r], rec["right" if direction == "pre" else "left"], True) + elif tag == "scalar": + op = event[1] + kind, dest = op[0], tuple(op[1]) + if kind == "clear": + rows[dest] = ZERO + elif kind == "copy": + rows[dest] = rows[tuple(op[2])] + elif kind == "scale": + rows[dest] = scale(rows[dest], Fraction(op[2], op[3])) + elif kind == "add": + rows[dest] = add(rows[dest], rows[tuple(op[2])], Fraction(op[3], op[4])) + else: + raise ValueError("probe scalar") + else: + raise ValueError("probe event") + for i in range(704): + if i < 112: + expected = fourier(normalized.get(i, ZERO), 9) + elif i < 224: + expected = fourier(translate_root(normalized.get(i-112, ZERO), word["ports"][i-112], -1), 9) + else: + expected = ZERO + need(rows["L", i] == expected, "direct native complete endpoint") + need(all(not vec[0] for role, vec in rows.items() if role[0] == "C"), "direct native private exit") + return {"engine": "unpacked Gaussian-dyadic literal stream", "events": len(events), + "inputs": "one encoded centre-basis vector, v=address basis0; every other input zero", + "source_sha256": source_hash, "ordinary_endpoint_amplitudes": 704*DIM, + "centre_values_checked": 8*DIM, "scatter_values_checked": 112*DIM, + "source_to_helper_response": "zero", "private_exit": "zero"} diff --git a/research/selected-centre-native-lift/test_verify.py b/research/selected-centre-native-lift/test_verify.py new file mode 100644 index 0000000000..3d3ea9810b --- /dev/null +++ b/research/selected-centre-native-lift/test_verify.py @@ -0,0 +1,74 @@ +"""Independent determinant oracle and live-input binding controls. Apache-2.0.""" +from fractions import Fraction +import importlib.util +import itertools +import json +import math +from pathlib import Path +import shutil +import tempfile +import unittest + +HERE = Path(__file__).resolve().parent +spec = importlib.util.spec_from_file_location("native_lift_verifier", HERE / "verify.py") +V = importlib.util.module_from_spec(spec) +spec.loader.exec_module(V) + + +def permutation_determinant(matrix): + """Leibniz sum, independent of the verifier's elimination/inverse witness.""" + denominator = math.lcm(*(x.denominator for row in matrix for x in row)) + integers = [[int(x*denominator) for x in row] for row in matrix] + total, n = 0, len(matrix) + for p in itertools.permutations(range(n)): + product = math.prod(integers[i][p[i]] for i in range(n)) + if product: + odd = sum(p[i] > p[j] for i in range(n) for j in range(i+1, n)) % 2 + total += -product if odd else product + return Fraction(total, denominator**n) + + +class IndependentChecks(unittest.TestCase): + def test_three_minor_determinants_by_permutations(self): + result = json.loads((HERE / "RESULT.json").read_text()) + for matrix, determinant in (("source_minor", "source_minor_det"), + ("scatter_minor", "scatter_minor_det"), + ("native_output_coefficient_minor", "native_output_coefficient_det")): + a = [[Fraction(x) for x in row] for row in result[matrix]] + self.assertEqual(permutation_determinant(a), Fraction(result[determinant])) + a[-1] = a[0].copy() + self.assertEqual(permutation_determinant(a), 0) + + def copy_inputs(self, destination): + pins = json.loads((HERE / "SOURCES.json").read_text()) + for row in pins["files"]: + if row["usage"] == "input": + target = destination / row["path"] + target.parent.mkdir(parents=True, exist_ok=True) + shutil.copyfile(V.ROOT / row["path"], target) + + def test_input_relocation_then_archive_corruption(self): + with tempfile.TemporaryDirectory(prefix="centre-rank-inputs-") as tmp: + root = Path(tmp) + self.copy_inputs(root) + data, kernel = V.load(root) + self.assertEqual(kernel.DIM, 512) + self.assertEqual(len(data["programs"]["forward"]), 24767) + archive = root / V.ARCHIVE + with archive.open("ab") as output: + output.write(b"corruption") + with self.assertRaisesRegex(ValueError, "source hash"): + V.load(root) + + def test_kernel_corruption_rejected_before_import(self): + with tempfile.TemporaryDirectory(prefix="centre-rank-kernel-") as tmp: + root = Path(tmp) + self.copy_inputs(root) + with (root / V.KERNEL).open("a") as output: + output.write('\nraise RuntimeError("unbound kernel executed")\n') + with self.assertRaisesRegex(ValueError, "source hash"): + V.load(root) + + +if __name__ == "__main__": + unittest.main() diff --git a/research/selected-centre-native-lift/verify.py b/research/selected-centre-native-lift/verify.py new file mode 100644 index 0000000000..1382ea4e21 --- /dev/null +++ b/research/selected-centre-native-lift/verify.py @@ -0,0 +1,460 @@ +#!/usr/bin/env python3 +"""Exact selected two-cut native rank lift; see README for the transcript model. + +Prepared for commdata2338 (@commdata2338), with substantial OpenAI Codex +assistance. Apache-2.0. Clifford evaluation reuses Sagar Thakrar's pinned +kernel; the stream audit and rank application below are new. +""" +import argparse +from collections import Counter +from copy import deepcopy +from fractions import Fraction as Q +import gzip +import hashlib +import importlib.util +import json +from pathlib import Path +import tarfile + +HERE = Path(__file__).resolve().parent +ROOT = HERE.parents[1] +ARCHIVE = "research/community-frontier1094-audit/selected-replay.tar.gz" +KERNEL = "research/frontier1094-recipes-exact-seed76/clifford.py" +PIVOTS = [0, 1, 2, 3, 4, 5, 6, 12] +PHASES = ["zero_frame_precondition", "entry_adapters", "A", "centers", "B", + "cleanup_tail", "final", "exit_adapters", "full_frame_cleanup", "done"] + + +def need(ok, reason): + if not ok: + raise ValueError(reason) + + +def sha(raw): + return hashlib.sha256(raw).hexdigest() + + +def canonical(obj): + return json.dumps(obj, sort_keys=True, separators=(",", ":")).encode() + + +def load(root): + sources = json.loads((HERE / "SOURCES.json").read_text()) + for row in sources["files"]: + if row["usage"] == "input": + need(sha((root / row["path"]).read_bytes()) == row["sha256"], + "source hash: " + row["path"]) + out = {} + with tarfile.open(root / ARCHIVE, "r:gz") as archive: + for key, pin in sources["archive_members"].items(): + members = [m for m in archive.getmembers() if m.name == pin["path"]] + need(len(members) == 1 and members[0].isfile(), "unique archive member") + raw = archive.extractfile(members[0]).read() + need(sha(raw) == pin["sha256"], "member hash: " + key) + out[key] = json.loads(gzip.decompress(raw) if pin["path"].endswith(".gz") else raw) + spec = importlib.util.spec_from_file_location("pinned_rank_lift_clifford", root / KERNEL) + kernel = importlib.util.module_from_spec(spec) + spec.loader.exec_module(kernel) + return out, kernel + + +def add_into(row, source, coefficient): + for key, value in list(source.items()): + new = row.get(key, Q(0)) + coefficient * value + if new: + row[key] = new + else: + row.pop(key, None) + + +def identity(n): + return [[Q(i == j) for j in range(n)] for i in range(n)] + + +def matmul(a, b): + return [[sum((x*y for x, y in zip(row, col)), Q(0)) for col in zip(*b)] + for row in a] + + +def inverse_and_det(matrix): + n = len(matrix) + need(n > 0 and all(len(row) == n for row in matrix), "square minor") + a = [[Q(x) for x in row] + [Q(i == j) for j in range(n)] + for i, row in enumerate(matrix)] + determinant = Q(1) + for j in range(n): + pivot = next((i for i in range(j, n) if a[i][j]), None) + need(pivot is not None, "singular minor") + if pivot != j: + a[j], a[pivot] = a[pivot], a[j] + determinant = -determinant + v = a[j][j] + determinant *= v + a[j] = [x / v for x in a[j]] + for i in range(n): + if i != j and a[i][j]: + v = a[i][j] + a[i] = [x - v*y for x, y in zip(a[i], a[j])] + inverse = [row[n:] for row in a] + need(matmul(matrix, inverse) == identity(n), "right inverse") + need(matmul(inverse, matrix) == identity(n), "left inverse") + return inverse, determinant + + +def independent_rows(matrix): + basis, chosen = {}, [] + for i, original in enumerate(matrix): + row = [Q(x) for x in original] + for j, pivot in sorted(basis.items()): + c = row[j] + row = [x - c*y for x, y in zip(row, pivot)] + lead = next((j for j, x in enumerate(row) if x), None) + if lead is not None: + v = row[lead] + basis[lead] = [x/v for x in row] + chosen.append(i) + return chosen + + +def residual_pair(event): + need(len(event) in (4, 5), "wrapper syntax") + return event[3], event[4] if len(event) == 5 else 1 + + +def audit_stream(word, events): + """Check extended labels and replay every arbitrary ordinary input column. + + Labels preS/preW/postT/doneW have the operators defined in README. + No scalar ADD may cross one of these noncanonical boundary labels. + """ + v, n = word["v"], 2*word["v"] + word["R"] + need((word["h"], v, n) == (9, 112, 704), "selected dimensions") + wrapped = {i for i in range(2*v, n) if (word["start"][i], word["final"][i]) != (0, 1)} + labels = {("L", i): ("preS", i) if i < v else ("preW", i) if i in wrapped + else ("T", word["start"][i]) for i in range(n)} + rows = {("L", i): {i: Q(1)} for i in range(n)} + phases, conversions, edges, bill = [], Counter(), set(), Counter() + private_seen = set() + phase = None + sources = targets = None + scatter = {i: [Q(0)]*8 for i in range(v, 2*v)} + for event in events: + tag = event[0] + if tag == "phase": + phase = event[1] + phases.append(phase) + if phase == "centers": + sources = [dict(rows["L", i]) for i in word["centers"]] + targets = [dict(rows["L", i]) for i in range(v, 2*v)] + continue + if tag == "climb": + _, part, r, old, new, rank = event + need(part == phase, "climb phase") + need(labels["L", r] == ("T", old), "climb source label") + need(rank == len(word["frames"][new])-len(word["frames"][old]) > 0, "climb rank") + labels["L", r] = ("T", new) + edges.add((old, new, rank)) + elif tag == "center": + _, k, old, new, rank = event + need(phase == "centers" and labels.get(("C", k)) == ("T", old), "centre source label") + need(rank == len(word["frames"][old])-len(word["frames"][new]) == 8, "centre rank") + labels["C", k] = ("T", new) + edges.add((old, new, rank)) + bill["rank8"] += 1 + elif tag == "adapter": + _, direction, r, frame = event + need(direction in ("old_to_new", "new_to_old"), "adapter direction") + conversions[direction, r] += 1 + if direction == "old_to_new": + need(phase == "entry_adapters" and frame == word["start"][r], "entry adapter") + if r < v: + need(labels["L", r] == ("preS", r), "source conversion label") + labels["L", r] = ("T", frame) + else: + need(labels["L", r] == ("T", 0) and frame == 0, "identity entry") + else: + need(phase == "exit_adapters" and frame == word["final"][r], "exit adapter") + need(labels["L", r] == ("T", frame), "exit conversion label") + if v <= r < 2*v: + labels["L", r] = ("postT", r) + else: + need(frame == 1, "identity exit") + elif tag == "residual_adapter": + direction, r = event[1:3] + a, b = residual_pair(event) + need(r in wrapped and (a, b) == (word["start"][r], word["final"][r]), "wrapper endpoint binding") + need(direction in ("pre", "post"), "wrapper direction") + conversions[direction, r] += 1 + if direction == "pre": + need(phase == "entry_adapters" and labels["L", r] == ("preW", r), "pre-wrapper label") + labels["L", r] = ("T", a) + else: + need(phase == "full_frame_cleanup" and labels["L", r] == ("T", b), "post-wrapper label") + labels["L", r] = ("doneW", r) + elif tag == "scalar": + _, op, frame = event + kind, dest = op[0], tuple(op[1]) + if dest[0] == "C" and dest not in private_seen: + need(kind == "clear", "private initialization") + private_seen.add(dest) + if phase == "centers": + bill[kind] += 1 + if kind == "clear": + need(dest[0] == "C", "only private roles may clear") + rows[dest] = {} + labels[dest] = ("T", frame) + elif kind == "copy": + source = tuple(op[2]) + need(dest[0] == "C" and labels[source] == ("T", frame), "copy frame") + need(phase == "centers" and source == ("L", word["centers"][dest[1]]), "centre carrier binding") + rows[dest] = dict(rows[source]) + labels[dest] = ("T", frame) + elif kind == "scale": + need(labels[dest] == ("T", frame), "scale frame") + q = Q(op[2], op[3]) + need(q != 0, "invertible scalar scale") + rows[dest] = {i: q*x for i, x in rows[dest].items()} + elif kind == "add": + source = tuple(op[2]) + need(source != dest and labels[dest] == labels[source] == ("T", frame), "common frame") + q = Q(op[3], op[4]) + add_into(rows[dest], rows[source], q) + if phase == "centers": + need(dest[0] == "L" and v <= dest[1] < 2*v and source[0] == "C" and frame == 0, "scatter shape") + scatter[dest[1]][source[1]] += q + else: + raise ValueError("unknown scalar") + else: + raise ValueError("unknown event") + need(phases == PHASES, "phase order") + need(sources is not None and targets is not None, "source cut") + expected_conversions = Counter() + for i in range(n): + if i in wrapped: + expected_conversions["pre", i] = expected_conversions["post", i] = 1 + else: + expected_conversions["old_to_new", i] = 1 + if i < 2*v or word["final"][i] == 1: + expected_conversions["new_to_old", i] = 1 + expected_label = (("T", 1) if i < v else ("postT", i) if i < 2*v else + ("doneW", i) if i in wrapped else ("T", 1)) + need(labels["L", i] == expected_label, "final extended label") + expected = {i: Q(1)} + if v <= i < 2*v: + expected[i-v] = Q(1) + need(rows["L", i] == expected, "complete scalar endpoint") + need(conversions == expected_conversions, "complete conversion inventory") + need(private_seen == {("C", i) for i in range(8)}, "private inventory") + need(all(not row for r, row in rows.items() if r[0] == "C"), "private exit") + need(bill == Counter(add=176, copy=8, clear=16, rank8=8), "phase invoice") + need(all(not any(row.get(j, 0) for j in PIVOTS) for row in targets), "targets already carry pivot information") + source_minor = [[row.get(j, Q(0)) for j in PIVOTS] for row in sources] + target_ids = [i for i, row in scatter.items() if any(row)] + return {"source_minor": source_minor, "source_rows": sources, + "scatter": [scatter[i] for i in target_ids], "target_ids": target_ids, + "edges": edges, "wrapped": wrapped, "bill": dict(bill), + "conversions": len(conversions), "scalar_columns": n} + + +def bind_calls(template, events): + calls = sorted(template["calls"], key=lambda c: c["time"])[:2] + need([(c["time"], c["stage"], c["replica"], c["orientation"], c["provider_id"]) + for c in calls] == [(0, 0, 0, "forward", "gauge44"), (1, 0, 8, "forward", "gauge44")], "call pair") + sweeps = template["execution_schedule"][:2] + need(len(sweeps) == 2 and all(x["kind"] == "local_cover_sweep" for x in sweeps), + "uninterrupted first two sweeps") + for c, sweep in zip(calls, sweeps): + need(all(c[k] == sweep[k] for k in ("time", "stage", "replica", "provider_id")), "complete-call sweep order") + need(c["local_program_sha256"] == sha(canonical(events)), "call program binding") + need(c["window"] == {"local_axes": list(range(9)), "prefix_axes": []}, "stage-zero window") + owners = [e[0] for e in c["owners"]] + need(len(owners) == len(set(owners)) == 704, "owner injectivity") + need(all(e[1] == [1, 0, i % 112] for i, e in enumerate(c["owners"][:224])), "stage-zero data charts") + sets = [{e[0] for e in c["owners"]} for c in calls] + shared = sets[0] & sets[1] + for c in calls: + need(not shared & {e[0] for e in c["owners"][:224]}, "shared data owner") + need(len(shared) == 30 and len(sets[0] | sets[1]) == 1378, "selected owner census") + return calls, sorted(shared) + + +def check_operators(word, recipes, residuals, audited, C): + """All-column identities for every forward climb and centre descent. + + The residual tariff identity is not needed for this information bound; + the literal wrappers must be invertible and attached to their own roles. + """ + frame = {i: C.canonical_frame(U) for i, U in enumerate(word["frames"])} + children = {(r["old"], r["new"]): r for r in recipes["children"]} + need(len(children) == len(recipes["children"]), "unique child recipes") + groups = {} + for a, b, rank in audited["edges"]: + r = children.get((a, b)) + need(r is not None and r["rank"] == rank, "used child recipe") + need(C.well_formed(r["left"]) and C.well_formed(r["right"]), "child monomial") + small, large = sorted((word["frames"][a], word["frames"][b]), key=len) + need(C.f2_rank(small+large) == len(large), "nested child frames") + groups.setdefault(b, []).append(r) + checked = [] + for b, group in sorted(groups.items()): + K = max(max(C.c_gates(frame[r["old"]])+r["rank"], C.c_gates(frame[b])) for r in group) + beta = C.radix(K) + wanted = C.run(frame[b], beta) + for r in sorted(group, key=lambda r: r["old"]): + circuit = frame[r["old"]] + C.monomial(r["right"]) + C.fourier(r["rank"]) + C.monomial(r["left"]) + need(C.equal(C.run(circuit, beta), C.c_gates(circuit), wanted, C.c_gates(frame[b]), beta), "native child identity") + checked.append([r["old"], b, r["rank"]]) + adapters = {(r["role"], r["port"]): r for r in recipes["endpoint_adapters"]} + need(len(adapters) == len(recipes["endpoint_adapters"]) == 224, "adapter inventory") + for i, q in enumerate(word["ports"]): + for role, position in (("source", i), ("target", i+112)): + rec = adapters[role, i] + f = word["start"][position] if role == "source" else word["final"][position] + need(rec["frame"] == f and C.well_formed(rec["left"]), "adapter frame binding") + old = [("C", q, 1)] if role == "source" else [("C", q, -1)]+C.fourier(9) + need(C.same_operator(old+C.monomial(rec["left"]), frame[f]), "native data adapter") + wrapper_keys = set() + for i in audited["wrapped"]: + a, b = word["start"][i], word["final"][i] + key = str(a) if b == 1 else f"{a}:{b}" + rec = residuals["recipes"][key] + need(rec["frame"] == a and rec.get("terminal", 1) == b, "wrapper record binding") + need(C.well_formed(rec["left"]) and C.well_formed(rec["right"]), "invertible wrapper") + wrapper_keys.add(key) + for j in PIVOTS: + need(C.same_operator([("C", word["ports"][j], 1), ("C", word["ports"][j], -1)], []), "input twist inverse") + return {"used_child_recipes": len(checked), "used_child_keys_sha256": sha(canonical(sorted(checked))), + "endpoint_adapter_identities": 224, "invertible_wrapper_records": len(wrapper_keys), + "operator_columns": 512, "input_twist_inverses": 8}, children, adapters + + +def controls(word, events, template, audited, C, children, adapters): + passed = [] + + def rejected(name, action, reason): + try: + action() + except ValueError as error: + need(reason in str(error), "unrelated control failure: " + name) + passed.append(name) + else: + raise ValueError("accepted control: " + name) + + j = next(i for i, e in enumerate(events) if e[0] == "climb") + rejected("omitted_climb", lambda: audit_stream(word, events[:j]+events[j+1:]), "frame") + bad = deepcopy(events) + e = next(e for e in bad if e[0] == "scalar" and e[1][0] == "add" and e[2] != 0) + e[2] = 0 + rejected("wrong_common_frame", lambda: audit_stream(word, bad), "common frame") + j = events.index(["phase", "full_frame_cleanup"])+1 + rejected("omitted_cleanup_gate", lambda: audit_stream(word, events[:j]+events[j+1:]), "complete scalar endpoint") + j = events.index(["phase", "B"])-1 + need(events[j][0] == "scalar" and events[j][1][0] == "clear", "clear control fixture") + rejected("omitted_private_clear", lambda: audit_stream(word, events[:j]+events[j+1:]), "private exit") + wrong_template = deepcopy(template) + calls = sorted(wrong_template["calls"], key=lambda c: c["time"])[:2] + calls[1]["owners"][0][0] = calls[0]["owners"][0][0] + rejected("shared_source_owner", lambda: bind_calls(wrong_template, events), "shared data owner") + wrong_schedule = deepcopy(template) + wrong_schedule["execution_schedule"].insert(1, {"kind": "bridge"}) + rejected("intervening_bridge", lambda: bind_calls(wrong_schedule, events), "uninterrupted first two sweeps") + singular = deepcopy(audited["source_minor"]) + for row in singular: + row[-1] = row[0] + rejected("duplicate_pivot_column", lambda: inverse_and_det(singular), "singular minor") + a, b, _ = sorted(audited["edges"])[0] + rec = deepcopy(children[a, b]) + rec["left"]["phase"] = (rec["left"]["phase"]+1) % 4 + bad_circuit = (C.canonical_frame(word["frames"][a])+C.monomial(rec["right"]) + +C.fourier(rec["rank"])+C.monomial(rec["left"])) + need(not C.same_operator(bad_circuit, C.canonical_frame(word["frames"][b])), "phase control") + passed.append("wrong_child_global_phase") + rec = adapters["source", PIVOTS[0]] + wrong = [("C", word["ports"][PIVOTS[1]], 1)]+C.monomial(rec["left"]) + need(not C.same_operator(wrong, C.canonical_frame(word["frames"][rec["frame"]])), "wrong port control") + passed.append("wrong_source_port") + # For every nonzero 512-address vector v, normalized sources (e0*v,-e0*v) + # pool to zero but give nonzero separate scatter outputs. Actual inputs + # are C_q times the coefficients of P^-1 e0. + pinv, _ = inverse_and_det(audited["source_minor"]) + z = matmul(audited["source_minor"], [[row[0]] for row in pinv]) + need(z == [[Q(i == 0)] for i in range(8)], "encoded centre basis") + need(any(row[0] for row in matmul(audited["scatter"], z)), "pooled witness scatter") + need(all(x[0]-x[0] == 0 for x in z), "pooled source sum") + passed.append("pooled_totals_lose_nonzero_scatter") + return passed + + +def run(root): + data, C = load(root) + word, events = data["word"], data["programs"]["forward"] + audited = audit_stream(word, events) + calls, shared = bind_calls(data["template"], events) + P = audited["source_minor"] + Pinv, pdet = inverse_and_det(P) + selected_rows = independent_rows(audited["scatter"]) + need(len(selected_rows) == 8, "scatter rank eight") + B = [audited["scatter"][i] for i in selected_rows] + Binv, bdet = inverse_and_det(B) + K = matmul(B, P) + Kinv, kdet = inverse_and_det(K) + need(kdet == pdet*bdet, "minor determinant product") + predecessor = json.loads((root / "research/selected-centre-composed-source-rank/RESULT.json").read_text()) + pivot_owners = [c["owners"][j][0] for c in calls for j in PIVOTS] + need(pivot_owners == predecessor["source_data_pivot_owner_ids"], "predecessor pivot binding") + native, children, adapters = check_operators(word, data["recipes"], data["residuals"], audited, C) + passed = controls(word, events, data["template"], audited, C, children, adapters) + probe_spec = importlib.util.spec_from_file_location("centre_literal_probe", HERE / "native_probe.py") + probe_module = importlib.util.module_from_spec(probe_spec) + probe_spec.loader.exec_module(probe_module) + probe_args = (data["residuals"], PIVOTS, Pinv, audited["scatter"], audited["target_ids"], C) + direct = probe_module.probe(word, events, data["recipes"], *probe_args) + bad_recipes = deepcopy(data["recipes"]) + descent = next(r for r in bad_recipes["children"] + if (r["old"], r["new"]) == (word["center_frames"][0], 0)) + descent["left"]["phase"] = (descent["left"]["phase"]+1) % 4 + try: + probe_module.probe(word, events, bad_recipes, *probe_args) + except ValueError as error: + need("direct native scatter" in str(error), "unrelated native probe control failure") + else: + raise ValueError("accepted native descent phase mutation") + passed.append("literal_native_descent_phase") + qmatrix = lambda a: [[str(x) for x in row] for row in a] + return {"status": "PASS_SELECTED_CENTRE_NATIVE_LIFT", "times": [0, 1], "replicas": [0, 8], + "stage": 0, "ordinary_scalar_columns": audited["scalar_columns"], "events": len(events), + "extended_label_violations": 0, "conversion_events": audited["conversions"], + "shared_helper_owners": shared, "shared_data_owners": 0, "source_to_helper_endpoint_block": "zero", + "target_pivot_block_at_centre_entry": "zero", "pivot_input_owners": pivot_owners, + "source_minor": qmatrix(P), "source_minor_inverse": qmatrix(Pinv), "source_minor_det": str(pdet), + "scatter_minor_target_roles": [audited["target_ids"][i] for i in selected_rows], + "scatter_minor": qmatrix(B), "scatter_minor_inverse": qmatrix(Binv), "scatter_minor_det": str(bdet), + "native_output_coefficient_minor": qmatrix(K), "native_output_coefficient_inverse": qmatrix(Kinv), + "native_output_coefficient_det": str(kdet), "source_port_twists": [word["ports"][j] for j in PIVOTS], + "centre_frames": word["center_frames"], "native_source_rank_per_call": 8*512, + "native_source_rank_two_cuts": 16*512, "native_scatter_history_rank": 16*512, + "eight_row_transcript_dimension": 8*512, "native_operator_checks": native, + "literal_native_probe": direct, + "unchanged_two_phase_bill": {k: 2*v for k, v in sorted(audited["bill"].items())}, + "unchanged_transport_rank_mass": 128, "controls": passed, + "scope": "Exact 512-address local native rank and conditional source-only transcript exclusion; no recursive-call minimum or supplier gain."} + + +def main(): + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument("--root", type=Path, default=ROOT) + parser.add_argument("--write-result", type=Path, help="write an absent receipt path exclusively") + args = parser.parse_args() + result = run(args.root) + if args.write_result: + with args.write_result.open("x") as output: + output.write(json.dumps(result, indent=2, sort_keys=True)+"\n") + else: + need(result == json.loads((HERE / "RESULT.json").read_text()), "result receipt mismatch") + print("PASS_SELECTED_CENTRE_NATIVE_LIFT source_rank=8192 scatter_rank=8192 " + f"children={result['native_operator_checks']['used_child_recipes']} columns=512 " + f"controls={len(result['controls'])} no_new_kappa") + + +if __name__ == "__main__": + main()