From 613c02b8b4411f991f108dcc1481b3f9100b996f Mon Sep 17 00:00:00 2001 From: commdata2338 <199849969+commdata2338@users.noreply.github.com> Date: Mon, 12 Oct 2026 22:39:28 -0500 Subject: [PATCH] Research: complete native BIT shear boundaries with exact query costs Adds research/native-fusion-restored-shear/. It gives three restored DATA-shear implementations for the unipotent ADDRESS permutation of PR #521 (head a190fdb39f31647fc6f651625353710624627348), with complete local cost recurrences, scoped query lower bounds and an exact checker. No new kappa: the selected certificate and upstream/ are unchanged. Sprint track: recursive interfaces, OS assignment seed 57, base 66849e1475c930fd7732b1a0067ffee7e1e95f60. Submitted by @commdata2338. Prepared with substantial AI assistance: OpenAI Codex (GPT-6-Astra) wrote the analysis, proof and checker, and Claude Code (Claude Opus 5.5) packaged the submission. No independent human peer review is claimed. Co-Authored-By: Claude Opus 5.5 (1M context) Claude-Session: https://claude.ai/code/session_01X86sCSXdoDd61SDFfC1PKG --- .../native-fusion-restored-shear/CLAIM.md | 72 +++ .../EXPECTED.json | 229 +++++++++ .../native-fusion-restored-shear/NOTICE.md | 39 ++ .../native-fusion-restored-shear/PROGRAM.json | 197 +++++++ .../native-fusion-restored-shear/PROOF.md | 383 ++++++++++++++ .../native-fusion-restored-shear/README.md | 69 +++ .../native-fusion-restored-shear/SOURCES.json | 59 +++ .../native-fusion-restored-shear/check.py | 479 ++++++++++++++++++ .../full_domain_check.py | 102 ++++ 9 files changed, 1629 insertions(+) create mode 100644 research/native-fusion-restored-shear/CLAIM.md create mode 100644 research/native-fusion-restored-shear/EXPECTED.json create mode 100644 research/native-fusion-restored-shear/NOTICE.md create mode 100644 research/native-fusion-restored-shear/PROGRAM.json create mode 100644 research/native-fusion-restored-shear/PROOF.md create mode 100644 research/native-fusion-restored-shear/README.md create mode 100644 research/native-fusion-restored-shear/SOURCES.json create mode 100644 research/native-fusion-restored-shear/check.py create mode 100644 research/native-fusion-restored-shear/full_domain_check.py diff --git a/research/native-fusion-restored-shear/CLAIM.md b/research/native-fusion-restored-shear/CLAIM.md new file mode 100644 index 0000000000..7b8eefea4f --- /dev/null +++ b/research/native-fusion-restored-shear/CLAIM.md @@ -0,0 +1,72 @@ +# Local sprint claim + +- Track: recursive interfaces; OS assignment seed **57**. +- Base: `66849e1475c930fd7732b1a0067ffee7e1e95f60`. +- Object: the unfinished private-state boundary of Karl Appel / applecrusher's + PR #521, head `a190fdb39f31647fc6f651625353710624627348`. +- Hypothesis: a restored DATA shear can eliminate the full-volume private BIT + row, but cannot retain the one-query price of the unfinished dirty module. +- Method: exact Laurent-polynomial operator classification; exhaustive rank-one + XOR charts on three and four rows; prime-power ADDRESS and dirty BIT controls. +- Deliverable: a scoped two-query restored-shear construction, complete local + child/tape recurrence, and either a query lower bound or a counterexample. + No new multiplication kappa or full interchange supplier is claimed. +- Expected finish: 2026-10-13 01:15 America/Chicago (06:15 UTC). +- Posting: local only; no GitHub write access. Anonymous issue search found + only #650 (Discussions), not a sprint coordination issue. + +## Candidate selection and overlap check + +Three narrow candidates were considered, in this order: + +1. Complete PR #521's unipotent BIT module at a restored DATA boundary. +2. Carry a terminal Clifford frame across adjacent recursive invocations. +3. Reuse dirty-helper preconditioning across successive source-stable calls. + +`57 mod 3 = 0` selects candidate 1. Candidates 2 and 3 have substantial overlap +with the selected cold-helper lineage and PR #390's preconditioning interface. +The initial anonymous inventory contained 478 open PRs; a second updated-PR +snapshot was checked immediately before this claim. No matching restored-shear +completion was found. PR #521 is recorded as unreviewed in the base ledger; +this work does not certify its full packet. + +Related work is expressly retained: PR #521 provides the ADDRESS word and +dirty-module representation; the in-tree `bit-three-register-lower-bound` +package and its PR #288 predecessor provide the scalar-projector/group-algebra +model. Our target is one off-diagonal restored shear, not their three full +diagonal interchanges. PR #83 rules out improvements from switching among a +fixed menu of complete recursion profiles; we do not repeat that search. The +rejected cross-family split-residual interface is not reopened. + +This is one local claim. A final result update will be added once. + +## Result update (local only) + +Completed: three exact restored-DATA-shear implementations, with 2 / 4 / 1 +ordinary recursive children for, respectively, no private row, a restored +dirty private row under triangular charts, and an owned disposable row. +The first two have sharp query lower bounds in their explicitly stated +models. The owned-row program pays a full source copy and final clear. +Complete typed recurrences include every child, affine event, XOR, copy, +clear, routing and inherited tape work. No new kappa is claimed. + +Evidence: 60,880 ordered signed projector pairs; all 4,681 native-chart words +through length four; 776 orbit BIT columns per program; a separate sparse-set +replay of all 729 addresses and 2,916 basis columns per program; 17,496 +full-domain endpoint/inverse cases; 17 meaningful negative controls. The +universal claims have written proofs and are not inferred from finite replay. + +Reproduce: `python3 -I -B research/native-fusion-restored-shear/check.py --check` +(expected first line `PASS_RESTORED_SHEAR_INTERFACES`). + +The final anonymous metadata refresh was 2026-10-13T03:20:29.895709+00:00. PR #521 remains +at `a190fdb39f31647fc6f651625353710624627348`. The 100 most recently updated +open PRs were rechecked against the initial 478-PR inventory; no matching +restored-shear contribution was found. Concurrent #663 at +`e0e546fd01b396478c68b6b6c5a16d87515983ba` audits a nonlinear dirty commutator; +#665 at `d0e4f1eb295e5cce508dc76c6937290a9175e42b` prices a complex spectral +encoding. Neither treats this fixed-permutation BIT shear or its workspace +tradeoff, and neither is a dependency. The issue search still found only +#650, with no coordination thread. This records the required claim update +locally; no issue, comment, claim or PR was posted. The branch and format-patch +are identified in the lane handback for the owner's submission decision. diff --git a/research/native-fusion-restored-shear/EXPECTED.json b/research/native-fusion-restored-shear/EXPECTED.json new file mode 100644 index 0000000000..343d63b617 --- /dev/null +++ b/research/native-fusion-restored-shear/EXPECTED.json @@ -0,0 +1,229 @@ +{ + "address": { + "basis_columns_including_two_address_spectators": 96, + "orbits": [ + { + "initial_scale": 1, + "length": 3, + "modulus": 3 + }, + { + "initial_scale": 1, + "length": 9, + "modulus": 9 + }, + { + "initial_scale": 1, + "length": 27, + "modulus": 27 + }, + { + "initial_scale": 1, + "length": 11, + "modulus": 11 + }, + { + "initial_scale": 1, + "length": 121, + "modulus": 121 + }, + { + "initial_scale": 3, + "length": 3, + "modulus": 9 + }, + { + "initial_scale": 3, + "length": 9, + "modulus": 27 + }, + { + "initial_scale": 11, + "length": 11, + "modulus": 121 + } + ], + "rational_and_modular_domains": [ + "Q", + 3, + 9, + 27, + 11, + 121 + ] + }, + "algebra": { + "native_chart_layers": [ + { + "queries": 0, + "solutions": 0, + "words": 1 + }, + { + "queries": 1, + "solutions": 0, + "words": 8 + }, + { + "queries": 2, + "solutions": 0, + "words": 64 + }, + { + "queries": 3, + "solutions": 0, + "words": 512 + }, + { + "queries": 4, + "solutions": 24, + "words": 4096 + } + ], + "projector_pairs": [ + { + "fixed_data_shear_solutions_with_both_private_diagonals_one": 0, + "nonzero_rank_one_nilpotent_targets": 3, + "ordered_signed_pairs": 144, + "projectors": 6, + "rows": 2, + "solutions": 12, + "solutions_by_left_right_sign": { + "-1,1": 6, + "1,-1": 6 + }, + "solutions_per_target": 4 + }, + { + "fixed_data_shear_solutions_with_both_private_diagonals_one": 0, + "nonzero_rank_one_nilpotent_targets": 21, + "ordered_signed_pairs": 3136, + "projectors": 28, + "rows": 3, + "solutions": 168, + "solutions_by_left_right_sign": { + "-1,1": 84, + "1,-1": 84 + }, + "solutions_per_target": 8 + }, + { + "fixed_data_shear_solutions_with_both_private_diagonals_one": 0, + "nonzero_rank_one_nilpotent_targets": 105, + "ordered_signed_pairs": 57600, + "projectors": 120, + "rows": 4, + "solutions": 1680, + "solutions_by_left_right_sign": { + "-1,1": 840, + "1,-1": 840 + }, + "solutions_per_target": 16 + } + ] + }, + "controls": { + "count": 17, + "rejected": [ + "no_private:omit_query_0", + "no_private:omit_query_2", + "dirty_private:omit_query_1", + "dirty_private:omit_query_3", + "dirty_private:omit_query_5", + "dirty_private:omit_query_7", + "clean_private:omit_query_2", + "no_private:use_forward_as_inverse", + "no_private:omit_xor_1", + "no_private:omit_xor_3", + "clean_private:claim_arbitrary_dirty_restoration", + "clean_private:omit_copy_0", + "clean_private:omit_clear_4", + "clean_private:reuse_unfinished_module_inverse_after_clear", + "address:omit_ordinary_child_keep_affine_wrappers", + "address:change_5_over_4_to_1", + "classification:extending_opposite_sign_rule_to_order_two" + ] + }, + "endpoints": { + "basis_columns_per_program": 776, + "clean_private_contract": "private input may be discarded; DATA and spectator input columns preserved as specified", + "fixed_point_assignments_across_three_programs": 48, + "invoices": { + "clean_private": { + "clear_scans": 1, + "copy_scans": 1, + "ordered_affine_events": 6, + "ordinary_children": 1, + "xor_scans": 2 + }, + "dirty_private": { + "clear_scans": 0, + "copy_scans": 0, + "ordered_affine_events": 24, + "ordinary_children": 4, + "xor_scans": 5 + }, + "no_private": { + "clear_scans": 0, + "copy_scans": 0, + "ordered_affine_events": 12, + "ordinary_children": 2, + "xor_scans": 2 + } + }, + "orbits": [ + { + "dirty_basis_columns": 12, + "initial_scale": 1, + "modulus": 3 + }, + { + "dirty_basis_columns": 36, + "initial_scale": 1, + "modulus": 9 + }, + { + "dirty_basis_columns": 108, + "initial_scale": 1, + "modulus": 27 + }, + { + "dirty_basis_columns": 44, + "initial_scale": 1, + "modulus": 11 + }, + { + "dirty_basis_columns": 484, + "initial_scale": 1, + "modulus": 121 + }, + { + "dirty_basis_columns": 12, + "initial_scale": 3, + "modulus": 9 + }, + { + "dirty_basis_columns": 36, + "initial_scale": 3, + "modulus": 27 + }, + { + "dirty_basis_columns": 44, + "initial_scale": 11, + "modulus": 121 + } + ] + }, + "full_domain": { + "endpoint_and_completed_inverse_cases": 17496, + "fixed_addresses": 243, + "full_address_count": 729, + "input_basis_columns_per_program": { + "clean_private": 2916, + "dirty_private": 2916, + "no_private": 2916 + }, + "method": "individual sparse-set BIT columns on the complete six-field address domain", + "modulus": 3 + } +} diff --git a/research/native-fusion-restored-shear/NOTICE.md b/research/native-fusion-restored-shear/NOTICE.md new file mode 100644 index 0000000000..bbd90a76bb --- /dev/null +++ b/research/native-fusion-restored-shear/NOTICE.md @@ -0,0 +1,39 @@ +# Attribution, license, and scope + +New prose and checker code in this packet are contributed under the +repository's Apache-2.0 license. The repository's LICENSE and NOTICE remain +unchanged. Submitted by @commdata2338. Prepared with substantial AI assistance: +OpenAI Codex (GPT-6-Astra) wrote the analysis, proof and checker, and +Claude Code (Claude Opus 5.5) packaged the submission. No independent +human peer review is claimed. + +- **Karl Appel / applecrusher, PR #521**, head + `a190fdb39f31647fc6f651625353710624627348`: the rank-one unipotent ADDRESS + map, its seven-event lowering, the reflected-query comparison, and the + dirty shared-chart operator. The ADDRESS word in PROGRAM.json is an + attributed transcription. The completed shear contracts, two-query + classification, cost comparison and fresh checker are this contribution. +- **OpenAI #109 / the imported upstream framework**: ordered-affine streams, + complete-range ordinary ADDRESS interchange, tape/stack and head-return + contracts. The two original sources at revision + `5996e33ecad6a0ccd578aec58831457829d75575` match the files in this base; + exact URLs and SHA-256 values are recorded in SOURCES.json. Their licenses + and repository notices are retained, and their interfaces remain premises. +- **eumemic, PR #288**, head + `475a088b5862f75f0b10596cfd6842d19531a5ec`, and **Ali Romman, PR #468**, + the in-tree `research/bit-three-register-lower-bound` package: the binary + scalar-projector/group-algebra model used for other interchange targets. + This packet credits that model and does not repeat the nine-call search. +- **Joseph Demarest, PR #83**, head + `183077b7b3ae12e96eb3a87c1dc08023e6494dca`: the scoped fixed-menu adaptive + recursion barrier, inspected when selecting this task. We do not claim + that rescheduling complete supplier profiles changes their best exponent. +- The selected #626/#622/#623 construction, #543 bit supplier, and cumulative + community authors retain their attribution. Their selected artifacts are + neither changed nor re-certified by this local note. + +No priority claim is made for the elementary compute/uncompute identities, +matrix determinant lemma, or Laurent-polynomial methods. The useful output +is the pinned component's explicit restored-boundary alternatives, their +precise model restrictions and paid recurrence, and exact reproducible +evidence for review. diff --git a/research/native-fusion-restored-shear/PROGRAM.json b/research/native-fusion-restored-shear/PROGRAM.json new file mode 100644 index 0000000000..ae9f58e27d --- /dev/null +++ b/research/native-fusion-restored-shear/PROGRAM.json @@ -0,0 +1,197 @@ +{ + "schema": "native-restored-shear-v1", + "rows": [ + "target", + "source", + "spectator", + "private" + ], + "address_forward": [ + { + "op": "affine", + "dst": 2, + "diagonal": "1", + "terms": [ + [ + 0, + "-1" + ] + ] + }, + { + "op": "affine", + "dst": 3, + "diagonal": "1", + "terms": [ + [ + 0, + "1" + ] + ] + }, + { + "op": "affine", + "dst": 5, + "diagonal": "1/4", + "terms": [ + [ + 0, + "5/4" + ], + [ + 2, + "-1/4" + ], + [ + 3, + "-1/4" + ] + ] + }, + { + "op": "child", + "fields": [ + 0, + 5 + ] + }, + { + "op": "affine", + "dst": 2, + "diagonal": "1", + "terms": [ + [ + 0, + "1" + ] + ] + }, + { + "op": "affine", + "dst": 3, + "diagonal": "1", + "terms": [ + [ + 0, + "-1" + ] + ] + }, + { + "op": "affine", + "dst": 5, + "diagonal": "-4", + "terms": [ + [ + 0, + "3" + ], + [ + 2, + "1" + ], + [ + 3, + "1" + ] + ] + } + ], + "programs": { + "no_private": [ + { + "op": "query", + "row": 0, + "direction": -1 + }, + { + "op": "xor", + "dst": 0, + "src": 1 + }, + { + "op": "query", + "row": 0, + "direction": 1 + }, + { + "op": "xor", + "dst": 0, + "src": 1 + } + ], + "dirty_private": [ + { + "op": "xor", + "dst": 3, + "src": 1 + }, + { + "op": "query", + "row": 3, + "direction": 1 + }, + { + "op": "xor", + "dst": 0, + "src": 3 + }, + { + "op": "query", + "row": 3, + "direction": -1 + }, + { + "op": "xor", + "dst": 3, + "src": 1 + }, + { + "op": "query", + "row": 3, + "direction": 1 + }, + { + "op": "xor", + "dst": 0, + "src": 3 + }, + { + "op": "query", + "row": 3, + "direction": -1 + }, + { + "op": "xor", + "dst": 0, + "src": 1 + } + ], + "clean_private": [ + { + "op": "copy", + "dst": 3, + "src": 1 + }, + { + "op": "xor", + "dst": 0, + "src": 1 + }, + { + "op": "query", + "row": 3, + "direction": 1 + }, + { + "op": "xor", + "dst": 0, + "src": 3 + }, + { + "op": "clear", + "row": 3 + } + ] + } +} diff --git a/research/native-fusion-restored-shear/PROOF.md b/research/native-fusion-restored-shear/PROOF.md new file mode 100644 index 0000000000..47d9bf59a3 --- /dev/null +++ b/research/native-fusion-restored-shear/PROOF.md @@ -0,0 +1,383 @@ +# Restored boundaries for one native unipotent BIT query + +This is a local interface result, conditional on the cited ordinary ADDRESS +interchange and ordered-stream primitives. It supplies no complete interchange +supplier and no multiplication exponent. The algebra below proves the stated +identities and scoped query bounds; the finite checker is corroboration, not a +formal proof of a full multiplication theorem. + +## 1. Object, predecessor, and boundary contracts + +Karl Appel / applecrusher's [PR #521](https://github.com/CrocSwap/integer-mult-bounds/pull/521), +pinned at `a190fdb39f31647fc6f651625353710624627348`, replaces two particular +reflected queries by one unipotent query. Its complete dirty operator retains +a private BIT row. It explicitly does not complete a DATA interchange or +authorize erasure of that row at an unfinished boundary. Its result is not +contradicted here. + +We choose a different, modest completed endpoint. For three genuine DATA rows +`(x,y,z)` and one fixed ADDRESS permutation `h`, let + + S_h(x,y,z) = (x + (h+I)y, y, z). (1) + +All VALUE additions in this note are XOR, over F2. ADDRESS arithmetic below +is rational arithmetic specialized to odd prime-power residue rings; these +two coefficient systems must not be conflated. Equation (1) is a shear, +not the three-DATA interchange. It satisfies `S_h^2 = I`, even though +`h^2 != I`. + +The contribution is an explicit comparison of three ways to complete (1): + +| Contract | Queries `h` or `h^-1` | Additional full row | Endpoint for that row | +|---|---:|---:|---| +| Query the DATA target | 2 | none | All other dirty rows untouched | +| Queries remain on one private row, with triangular source/target XORs | 4 | one | Arbitrary initial private contents restored | +| Caller owns disposable private storage | 1 | one | Explicit copy initialization and final zeroing | + +The first count is optimal in the fixed-`h` query/XOR model of section 4. +The second is optimal in the narrower private-row model of section 5 for +a uniform all-width program. These are **not** lower bounds for arbitrary +ordinary-interchange programs with different free ADDRESS operations. +The third changes the workspace contract: discarding someone else's dirty +row is not allowed. Its successful DATA endpoint makes its *own* final clear +legitimate. It is not evidence that clearing PR #521's private row is safe +inside an arbitrary surrounding construction. + +## 2. The retained query, with its actual recursive child + +Fix an odd prime `ell`, `b >= 1`, and `m = ell^b`. Use six ordered ADDRESS +fields `(H0,H1,H2,D0,D1,D2)`, all of width `b`, and all complete spectator +ranges. Define + + s = (1,0,1,-1,0,-1)^T, + r = (1,0,-1,-1,0,1)^T, + M = I6 + s r^T / 4, M^-1 = I6 - s r^T / 4. + +Here `r^T s = 0`. The permutation `h` moves the BIT at ADDRESS `a` to `M a`; +its action on values reads the inverse ADDRESS image. PR #521's literal +lowering, transcribed in `PROGRAM.json`, is + + a2 -= a0 + a3 += a0 + a5 = (a5 + 5*a0 - a2 - a3)/4 + CHILD_C(a0,a5) + a2 += a0 + a3 -= a0 + a5 = -4*a5 + 3*a0 + a2 + a3. (2) + +Substitution gives `M`. Reversing (2) and inverting each scalar event gives +`M^-1`. The child is an ordinary interchange of two `b`-digit ADDRESS fields +on the **entire selected BIT row**, including all other ADDRESS fields. +It is not a pointwise VALUE swap or an uncharged oracle. + +All six affine events read only earlier fields. Their diagonal numerators +and denominators are powers of two up to sign; denominators of controls are +also powers of two. Thus every event is well defined for every odd `ell`. +The cited ordered-stream lemma pays the finite coefficient preparation, +counter work, complete spectator scans, temporary work and head returns. +It does not assume unit-cost arithmetic on growing integers. + +The same implementation works on a DATA row or a private row: the ADDRESS +primitive's contract is for arbitrary BIT contents and is insensitive to +the role's name. Calls must be sequential and have exclusive access to the +queried row until its completed boundary. No source chart or current supplier +schedule is asserted to provide that permission automatically. + +For `a0 = e_H0`, the addresses `a_k = e_H0 + k*s/4`, `k in Z/m`, are distinct +and satisfy `M a_k = a_(k+1)`. Hence on their VALUE array, `(h y)_k = y_(k-1)`. +This supplies a nontrivial orbit of order `m`, as well as a direct finite +check on push/read orientation. There are also fixed points and shorter +orbits at nonunit initial scales; these are included in the replay. + +## 3. Three complete programs + +### 3.1 No full private row + +Apply, chronologically, + + x <- h^-1 x + x += y + x <- h x + x += y. (3) + +The output is `x + h y + y`; `y,z` and every unrelated row are untouched. +No row is assumed zero, copied, or erased. A pre-existing private row is +an untouched spectator. Source `y` is never modified, even temporarily. +The queried target may be permuted temporarily, so callers may not inspect +it between events. This is a restored boundary, not a concurrently readable +intermediate representation. + +### 3.2 Queries only on a restored dirty private row + +For arbitrary initial `q=q0`, use + + q += y + q <- h q + x += q + q <- h^-1 q + q += y + q <- h q + x += q + q <- h^-1 q + x += y. (4) + +The two contributions read into `x` are `h(q0+y)` and `h q0`. Their sum is +`h y`. The last XOR supplies `y`; both query/inverse pairs restore their +own input, and the two source XORs restore `q0`. Thus (4) implements (1) +on DATA and the identity on arbitrary private input. It has four queries +and five XORs, not four queries plus an implicit cleanup. + +### 3.3 An owned, disposable private row + +Allocate or reserve one owned full row `q`, whose incoming contents may be +discarded, and use + + q <- copy(y) + x += y + q <- h q + x += q + q <- 0. (5) + +The copy overwrites every private cell and pays source access and +initialization in one scan. Just before the last line, DATA already equals +(1), and `q=h y` is redundant with retained `y`. No later step reads `q`. +The final full-row clear therefore returns owned work storage to zero. +All five events are charged. There is no assumption that unknown dirty +caller state can be thrown away. + +Reapplying the *completed* program (5) implements `S_h^2=I` on DATA. This is +different from applying the inverse of PR #521's unfinished dirty module +after clearing its private row; that inverse generally fails. Both facts +are checked, including arbitrary DATA inputs and explicit private-input +rejection when (5) is falsely labeled a dirty-restoring program. + +The normal form of PR #521's dirty module is +`H(h)=I+E(h-I)`, `E=(e_x+e_q)(e_y+e_q)^T`. It directly explains the +tradeoff: for initial `q=0`, its DATA output is already (1), but its private +output is `(h+I)y`. Once (1) is declared and verified as the desired complete +endpoint, terminal operations needed solely for later dirty-module recovery +can be removed. Program (5) is the simpler paid copy implementation of that +completed endpoint. It changes neither the predecessor's two-reflection +identity nor its warning about other unfinished endpoints. + +## 4. Sharp two-query classification with arbitrary dirty spectators + +The model permits any number `d >= 2` of arbitrary dirty rows. Free algebraic +operations are invertible, address-independent XOR maps of the row roles; +actual implementations still pay for these scans. A query applies `h` or +`h^-1` to one row. No other nontrivial ADDRESS map, copying into clean storage, +or erasure is free in this lower-bound model. + +Represent `h` by `t`. Work over `F2[t,t^-1]`, or over +`F2[t,t^-1]/(t^m-1)` for an odd orbit length `m >= 3`. In the latter ring, +zero divisors cause no problem: the proof uses determinants and comparison +of distinct basis coefficients, not division or a fraction field. + +On an `m`-cycle, identify a BIT row with `sum_k value_k t^k`. The query is +multiplication by `t` on the regular module of the cyclic ring. Thus equality +of these row operators is equivalent to entrywise equality of their matrices +over that ring. The determinant below is taken **in this ring**, not the +ordinary F2 determinant of the expanded bit matrix. Restricting a complete +array to the full-order orbit in section 2 gives a necessary condition for +any claimed full-array identity. + +After conjugation by an invertible binary row map, one query is + + D_P(t^e) = I + (t^e-1) P, e in {+1,-1}, + P = u v^T, v^T u = 1. (6) + +These are precisely binary rank-one idempotents. Any arbitrary interleaving +of free XOR maps normalizes to a product of such factors: commute the +constant maps to the left, conjugating each projector as they pass. +At `t=1`, the desired endpoint is `I`, so the remaining constant factor +must be `I`. Thus allowing arbitrary endpoint XOR maps does not omit a +one-query or two-query solution from this model. + +Let `N=a b^T` be a nonzero rank-one nilpotent, `b^T a=0`; the desired shear is + + T_N(t) = I + (t-1) N. (7) + +The determinant lemma, valid over each stated commutative ring, gives +`det D_P(t^e)=t^e` and `det T_N(t)=1`. Zero queries cannot give the nonconstant +(7). One query has the wrong determinant. Two queries of the same sign also +have the wrong determinant, since `t^2 != 1` on an odd orbit of length at +least three. Therefore any two-query solution has opposite signs. + +For left sign `+1`, expand the product *in operator order*: + + D_P(t) D_Q(t^-1) + = I+P+Q + t(P+PQ) + t^-1(Q+PQ). (8) + +The coefficients of `1,t,t^-1` are independent in either ring, so (8) +equals (7) **if and only if** + + PQ=Q, P+Q=N. (9) + +For the other sign order the exact conditions are + + PQ=P, P+Q=N. (10) + +This is an exhaustive classification, not just a necessary filter. In (9), +the two rank-one images coincide and equal the image of `N`. Consequently + + P=a c^T, Q=a(c+b)^T, c^T a=1. (11) + +In (10), the two row spaces coincide and equal the row space of `N`, giving + + P=(c+a)b^T, Q=c b^T, b^T c=1. (12) + +Conversely, (11) or (12) directly verifies the corresponding conditions. +Over F2 there is no nontrivial scalar rescaling of a rank-one decomposition. +Each family has `2^(d-1)` choices, so every nonzero rank-one nilpotent target +has exactly `2^d` ordered, signed two-query factorizations. Program (3) +realizes one of them for `N=e_x e_y^T`, proving the two-query minimum. + +For any private index `q` distinct from `x,y`, all these factorizations have +`P_qq=Q_qq=0`: in (11) the image is `e_x`, and in (12) the row space is +`e_y^T`. This observation separates the unrestricted dirty-row model from +the private-only contract below. + +The scalar-projector/group-algebra method is established predecessor work: +eumemic's PR #288 and Ali Romman's in-tree `bit-three-register-lower-bound` +package (PR #468) use it for different diagonal interchange targets. We do +not claim that method as new. The present two-query classification targets +one off-diagonal restored shear and includes finite cyclic rings explicitly. + +## 5. Why the private-only dirty boundary costs four queries + +Here queries are restricted to `q`; the allowed pointwise gates are +`q += y`, `x += q`, and `x += y`. Source `y` and spectator rows remain +unchanged. A free-gate prefix has the triangular form + + K(x,y,q) = (x + a q + b y, y, q + c y). + +Both `K` and `K^-1` have `qq` entry one. A normalized query projector +`K^-1 e_q e_q^T K` therefore has `P_qq=1`. Section 4 shows that no +two-query factorization of (1) can have that property. A one-query program +is already excluded. A three-query program has determinant `t^j` for +`j in {-3,-1,1,3}`, so cannot have determinant one in the Laurent model, +or on an odd orbit of length at least five. Thus a uniform all-width +program needs at least four queries. Program (4) attains four. + +This proof does not assert a separate three-query exclusion for one isolated +order-three quotient from the determinant alone. The formal finite-word +check below is over Laurent coefficients, not modulo three. The uniform +claim has no gap: for example the actual order-eleven orbit already gives +the stated lower bound, and the program must work at that width too. + +Arbitrary XOR maps that swap a DATA role with `q`, arbitrary alternate +ADDRESS maps, non-restored private state, and clean/disposable storage are +outside this private-only restriction. Removing any of those restrictions +requires a new analysis; program (3) deliberately changes the first one. + +## 6. Complete typed costs and workspace + +Let each genuine DATA row have logical BIT volume `U`, including the full +ADDRESS domain and all spectators. Productive volume is `V=3U`, and nominal +chunk width is `N=3b`. Let: + +- `C(U,b)` be the cost of one ordinary interchange of the selected two + `b`-digit fields on a complete row of volume `U`, with restored child work; +- `A(U,b)` bound each fixed ordered-affine event of (2), including coefficient + preparation, its source access, temporary work, and head returns; +- `X(U)`, `P(U)`, and `Z(U)` bound one aligned XOR, full copy, and full clear; +- `R_j(V,b)` include row split/merge, routing to the fixed evaluator tapes, + descriptor setup, parking and recovery, allocation if needed, and head + returns not already charged in a primitive. Each `R_j=O(V)` under the + inherited complete-range, fixed-number-of-rows, and stack contract. + +The complete local recurrences/charges are + + S_data(V,3b) <= 2 C(U,b) + 12 A(U,b) + 2 X(U) + R_data(V,b), + S_dirty(V,3b) <= 4 C(U,b) + 24 A(U,b) + 5 X(U) + R_dirty(V,b), + S_owned(V,3b) <= C(U,b) + 6 A(U,b) + 2 X(U) + + P(U) + Z(U) + R_owned(V,b). (13) + +Every query is lowered using (2), so there are exactly 2, 4, and 1 ordinary +recursive children respectively, all of actual volume `V/3` and width `N/3`. +There is no dropped recovery child, additional live query, or implicit +source-copy oracle. All children run sequentially and reuse restored child +workspace. Primitive affine work may itself use temporary streams; those +are covered by `A`, not claimed absent by the phrase "no private row." + +Under the cited streaming contracts, the non-child terms of (13) are `O(V)`. +If `c(b)` uniformly bounds `C(U,b)/U`, then + + s_data(3b) <= (2/3)c(b) + O(1), + s_dirty(3b) <= (4/3)c(b) + O(1), + s_owned(3b) <= (1/3)c(b) + O(1). (14) + +The constants are independent of `b,U`, for a fixed permitted radix and +the fixed literal program. Fractions count the **actual child stream +volumes**, not the persistent stock. Persistent role storage is `V` for +(3), and `4V/3` for (4) and (5), before primitive/evaluator/recursive scratch. +For peak workspace, let `B_j(V,b)` include the fixed streaming and parking +workspace and `W_C(U,b)` child workspace. A safe bound is + + W_j(V,3b) <= persistent_j(V) + B_j(V,b) + W_C(U,b), + persistent_data=V, persistent_dirty=persistent_owned=4V/3. + +`B_j=O(V)` under the same tape primitives; the bound pays their temporary +streams and does not claim an exact number of physical tapes or total cells. +Private-row allocation is not normalized away. In the owned case the initial +copy and final clear are charged on every invocation, even if a later caller +could establish safe reuse. + +These are **typed** recurrences: the left side is a DATA shear and `C` is +ordinary ADDRESS interchange. Substituting `S_data` for `C` and solving a +self-recursion would be circular without a separate compiler. No such +compiler, arbitrary-width padding, common-frame schedule, or assembled +supplier is provided. For `N` not divisible by three this packet specifies +no reduction. The old all-size, row/stack, precision and analytic assumptions +are not discharged. In particular none of (13) or (14) is a new κ certificate. + +## 7. Reproducible evidence and exact limits + +`check.py --check` uses only Python's standard library and this directory. +It does not import the predecessor's checker or any supplier implementation. + +1. Enumerate all binary matrices at dimensions 2, 3 and 4; select rank-one + idempotents by independent rank and square tests; compare against the + outer-product catalogue. The sizes are 6, 28 and 120. +2. Multiply all **60,880 ordered signed pairs** as matrix Laurent polynomials. + Check (9)/(10) against the literal polynomial result for every pair and + every nonzero rank-one nilpotent target encountered. Every target has + `2^d` factorizations; none for a DATA coordinate shear has both private + diagonals one. +3. Exhaust all four native triangular charts + `(e_q+a e_x)(e_q+b e_y)^T`, `a,b in F2`, with both query signs, through + length four. The full **4,681-word** domain is completed: counts of + successes by length are `0,0,0,0,24`. This is a finite corroboration of + the specified model, not a search over arbitrary circuits or frames. +4. Verify (2) and its inverse on all rational ADDRESS basis columns and + modulo `3,9,27,11,121`, including two additional ADDRESS spectators. + Check full and shorter orbits from nonunit initial scales, plus fixed + points. These rings differ from PR #521's `5,25,7,49` replay. +5. Propagate all independent BIT basis columns simultaneously as distinct + integer bits, so every XOR-column cancellation is exact. Check all three + literal programs, their completed DATA involution, and the separate + owned-versus-dirty workspace contracts. No VALUE assignment is sampled. +6. Reject omissions of every recursive query, a wrong inverse, missing XORs, + missing owned initialization or clear, unpaid ADDRESS children, and the + false inference that owned clearing restores arbitrary dirty state. + A concrete order-two, same-sign factorization rejects extending the + opposite-sign classification to a domain where `t=t^-1`. + +The separate `full_domain_check.py` imports no main-checker code. It applies +the literal ADDRESS program to all **729 addresses in `(Z/3)^6`**, including +all 243 fixed addresses, and compares a separately written coordinate +formula. It then tracks individual sparse sets of nonzero BIT positions, +rather than packed symbolic columns, for **2,916 independent inputs per +program**. This covers every row and every address, not just a selected +orbit. Endpoints and completed inverses give **17,496 cases** across the +three programs. The private input is discarded only in the explicitly +owned-storage contract. This second finite method is included in the +single reproduction command. + +Assignment seed 57 selects candidate `57 mod 3 = 0` in `CLAIM.md`. The +algebraic domains and stopping rule above were fixed before implementing +the verifier; there is no random search whose losing trials are omitted. +The source pins and original attribution are in `SOURCES.json` and +`NOTICE.md`. `EXPECTED.json` records deterministic finite evidence. The +universal proof in sections 3–5 is a written argument open to review; +neither the exhaustive small-dimensional checks nor a PASS string replace it. diff --git a/research/native-fusion-restored-shear/README.md b/research/native-fusion-restored-shear/README.md new file mode 100644 index 0000000000..1fe0c70d15 --- /dev/null +++ b/research/native-fusion-restored-shear/README.md @@ -0,0 +1,69 @@ +# A completed shear boundary for the native fused BIT query + +Research note and exact verification; **no new κ**. + +For the unipotent ADDRESS permutation `h` in Karl Appel / applecrusher's +PR #521, this packet completes the DATA shear +`(x,y,z) -> (x XOR y XOR h(y), y, z)` under three explicit workspace contracts: + +| Implementation | Recursive children | Persistent full private rows | Workspace endpoint | +|---|---:|---:|---| +| Query the DATA target | 2 | 0 | Every unrelated dirty row preserved | +| Query only private storage with triangular XOR charts | 4 | 1 | Arbitrary private contents restored | +| Owned disposable storage, with paid copy and clear | 1 | 1 | Private row returned to zero | + +Each query has one ordinary ADDRESS-interchange child and six paid affine +events. The first program uses two XOR scans; the second five; the third +two XOR scans, one source-copy scan and one clear. Evaluator scratch, +complete spectators, routing, coefficient preparation and head returns +remain charged in the [typed cost recurrences](PROOF.md#6-complete-typed-costs-and-workspace). + +The two-query minimum is proved in the fixed-`h`, arbitrary-dirty-row XOR +model. The four-query minimum has the narrower private-only restriction. +Neither lower bound covers arbitrary alternate ADDRESS primitives. +The one-query implementation relies on ownership that permits overwriting +the private input; it is not a dirty-restoration implementation. + +Run from the repository root, with Python 3.10+ and no installed packages: + +```sh +python3 -I -B research/native-fusion-restored-shear/check.py --check +``` + +Expected first line: `PASS_RESTORED_SHEAR_INTERFACES`. The next lines give +the exact enumeration and control counts. The checker reads local packet +files and writes nothing with `--check`. +For focused checks use, for example, `--check -k endpoints`. +To intentionally regenerate the evidence use `--write-results`. + +The [proof](PROOF.md) includes the full two-query factorization +classification, the private-only restriction, literal programs, and every +local recursive child. The replay covers 60,880 signed projector pairs, +4,681 native-chart words, exact rational ADDRESS identities, and dirty BIT +columns on full/shorter prime-power orbits. This is not a formal verification +of the multiplication theorem or a cold replay of the selected supplier. +An independently implemented sparse-set replay also covers every address +in `(Z/3)^6`, with 2,916 basis inputs per program and 17,496 endpoint/inverse +cases. It is included in the same command. + +Base commit: `66849e1475c930fd7732b1a0067ffee7e1e95f60`; assignment seed **57**, +recursive-interfaces track. The base selected conditional κ remains +`51110230636731/31250000000000000`; the selected certificate and `upstream/` +are unchanged. All work is isolated to this directory. + +The new value is a completed resource/endpoint comparison and a sharp scoped +query classification. The ADDRESS lowering and unfinished-module identity +come from [PR #521](https://github.com/CrocSwap/integer-mult-bounds/pull/521) +at `a190fdb39f31647fc6f651625353710624627348`, which was unreviewed in the base +ledger. The algebra uses predecessor scalar-projector methods, credited in +[NOTICE.md](NOTICE.md). This work does not approve the rest of that PR. +Source URLs and SHA-256 pins are in [SOURCES.json](SOURCES.json). + +Open obligations: place a completed shear inside an actual supplier, +authorize its DATA query or disposable storage, price the resulting whole +profile, handle arbitrary widths, and discharge the inherited all-size and +tape interfaces. No saving is inferred merely from the local counts. + +Submitted by @commdata2338 with substantial AI assistance (OpenAI Codex, +GPT-6-Astra; packaged with Claude Code); no independent human review is +claimed. diff --git a/research/native-fusion-restored-shear/SOURCES.json b/research/native-fusion-restored-shear/SOURCES.json new file mode 100644 index 0000000000..31f50a00ec --- /dev/null +++ b/research/native-fusion-restored-shear/SOURCES.json @@ -0,0 +1,59 @@ +{ + "base_commit": "66849e1475c930fd7732b1a0067ffee7e1e95f60", + "assignment_seed": 57, + "selected_conditional_kappa": "51110230636731/31250000000000000", + "runtime_dependencies": "Python 3.10+ standard library; this packet only; no network", + "base_sources": [ + { + "path": "upstream/build/sections/02-streams.tex", + "sha256": "606c80db61cad13aa0c3b6060dc4b88dbbe7ac60cdd831aa93f28d908fd09dab", + "url": "https://github.com/CrocSwap/integer-mult-bounds/blob/66849e1475c930fd7732b1a0067ffee7e1e95f60/upstream/build/sections/02-streams.tex" + }, + { + "path": "upstream/build/sections/04-swap.tex", + "sha256": "412b170ccaab38dba96e95e3cbfae09f4876a9818f8d278776a746b0f8044906", + "url": "https://github.com/CrocSwap/integer-mult-bounds/blob/66849e1475c930fd7732b1a0067ffee7e1e95f60/upstream/build/sections/04-swap.tex" + }, + { + "path": "research/bit-three-register-lower-bound/README.md", + "sha256": "c12b33ef388deece0cbf891505a2ce2c0779a0c3a6cf1f0f7f7039bab59cbebd", + "url": "https://github.com/CrocSwap/integer-mult-bounds/blob/66849e1475c930fd7732b1a0067ffee7e1e95f60/research/bit-three-register-lower-bound/README.md" + }, + { + "path": "certificates/selected-result.json", + "sha256": "b3bf402f31a69bde0629936a9b569bed48281568d7b16d5fba120b5311ea1f53", + "url": "https://github.com/CrocSwap/integer-mult-bounds/blob/66849e1475c930fd7732b1a0067ffee7e1e95f60/certificates/selected-result.json" + }, + { + "path": "docs/research/community-k492-review.md", + "sha256": "3b731d30e80010b15408a289b0b32192700885474c8b36d48ee3320a7a8c5c47", + "url": "https://github.com/CrocSwap/integer-mult-bounds/blob/66849e1475c930fd7732b1a0067ffee7e1e95f60/docs/research/community-k492-review.md" + } + ], + "predecessor": { + "pr": 521, + "author": "Karl Appel / applecrusher", + "commit": "a190fdb39f31647fc6f651625353710624627348", + "url": "https://github.com/CrocSwap/integer-mult-bounds/pull/521", + "review_status_at_base": "unreviewed", + "files": [ + { + "path": "research/native-unipotent-fusion/PROOF.md", + "sha256": "320ce5529c1543f9e6fceb9e7f8b563ed332f13923229e38d4e7edac98f30283", + "url": "https://github.com/applecrusher/integer-mult-bounds/blob/a190fdb39f31647fc6f651625353710624627348/research/native-unipotent-fusion/PROOF.md" + }, + { + "path": "research/native-unipotent-fusion/PROGRAM.json", + "sha256": "2823b70730bc57d0eae09fba41ee2b6143825ac57471e884dfb85c5e8917dc25", + "url": "https://github.com/applecrusher/integer-mult-bounds/blob/a190fdb39f31647fc6f651625353710624627348/research/native-unipotent-fusion/PROGRAM.json" + }, + { + "path": "research/native-unipotent-fusion/SOURCE-PINS.json", + "sha256": "34f97e7a31deed0dd85474ece3709a55de495f9473a3619f84e991fdbd3bf732", + "url": "https://github.com/applecrusher/integer-mult-bounds/blob/a190fdb39f31647fc6f651625353710624627348/research/native-unipotent-fusion/SOURCE-PINS.json" + } + ] + }, + "predecessor_contract_revision": "5996e33ecad6a0ccd578aec58831457829d75575", + "source_readback": "Both upstream tape-source SHA256 values match PR521 SOURCE-PINS.json. The local ADDRESS word is transcribed from its PROGRAM.json; no predecessor checker is imported." +} diff --git a/research/native-fusion-restored-shear/check.py b/research/native-fusion-restored-shear/check.py new file mode 100644 index 0000000000..1db291e4eb --- /dev/null +++ b/research/native-fusion-restored-shear/check.py @@ -0,0 +1,479 @@ +#!/usr/bin/env python3 +"""Exact, standard-library checks for the scoped restored-shear interfaces. + +Apache-2.0. Prepared with substantial OpenAI Codex assistance. +No imports from any supplier or predecessor checker; no network or subprocesses. +The universal arguments are in PROOF.md, not inferred from these finite tests. +""" + +import argparse +from collections import Counter +from copy import deepcopy +from fractions import Fraction as F +from itertools import product +import json +from math import gcd +from pathlib import Path +import runpy +import sys + + +HERE = Path(__file__).resolve().parent + + +class CheckError(Exception): + pass + + +def require(condition, message): + # Deliberately independent of Python's assert / optimization flag. + if not condition: + raise CheckError(message) + + +def ident(n): + return tuple(1 << i for i in range(n)) + + +def mxor(a, b): + return tuple(x ^ y for x, y in zip(a, b)) + + +def mmul(a, b): + out = [] + for row in a: + value = 0 + for j, other in enumerate(b): + if (row >> j) & 1: + value ^= other + out.append(value) + return tuple(out) + + +def rank(a): + pivots = {} + for row in a: + while row: + p = row.bit_length() - 1 + if p not in pivots: + pivots[p] = row + break + row ^= pivots[p] + return len(pivots) + + +def outer(u, v, n): + return tuple(v if (u >> i) & 1 else 0 for i in range(n)) + + +def pmul(a, b): + """Matrix Laurent polynomials over F2, as exponent -> bit-row matrix.""" + n = len(next(iter(a.values()))) + zero = (0,) * n + result = {} + for e, x in a.items(): + for f, y in b.items(): + result[e + f] = mxor(result.get(e + f, zero), mmul(x, y)) + return {e: x for e, x in result.items() if any(x)} + + +def query_matrix(p, sign): + return {0: mxor(ident(len(p)), p), sign: p} + + +def cyclic_reduce(polynomial, modulus): + zero = (0,) * len(next(iter(polynomial.values()))) + result = {} + for exponent, coefficient in polynomial.items(): + residue = exponent % modulus + result[residue] = mxor(result.get(residue, zero), coefficient) + return {e: x for e, x in result.items() if any(x)} + + +def projector_catalogue(n): + # Enumerate *all* binary matrices, independently of the rank-one formula. + mask = (1 << n) - 1 + actual = set() + for bits in range(1 << (n * n)): + rows = tuple((bits >> (n * i)) & mask for i in range(n)) + if rank(rows) == 1 and mmul(rows, rows) == rows: + actual.add(rows) + factored = { + outer(u, v, n) + for u in range(1, 1 << n) + for v in range(1, 1 << n) + if (u & v).bit_count() % 2 + } + require(actual == factored, "independent projector catalogues disagree") + return sorted(actual) + + +def algebra_checks(): + reports = [] + for n in (2, 3, 4): + eye, zero = ident(n), (0,) * n + projectors = projector_catalogue(n) + nilpotents = { + outer(u, v, n) + for u in range(1, 1 << n) + for v in range(1, 1 << n) + if not (u & v).bit_count() % 2 + } + targets = {p: {0: mxor(eye, p), 1: p} for p in nilpotents} + counts = Counter() + by_sign = Counter() + fixed = outer(1, 2, n) + fixed_private = 0 + checked = 0 + for p, q, left, right in product(projectors, projectors, (-1, 1), (-1, 1)): + actual = pmul(query_matrix(p, left), query_matrix(q, right)) + coefficient = actual.get(1, zero) + is_shear = coefficient in targets and actual == targets[coefficient] + pq = mmul(p, q) + predicted = ( + p != q and left == -right + and ((left == 1 and pq == q) or (left == -1 and pq == p)) + ) + require(is_shear == predicted, "two-query classification counterexample") + if is_shear: + require(coefficient == mxor(p, q), "wrong shear coefficient") + counts[coefficient] += 1 + by_sign[f"{left},{right}"] += 1 + if n >= 3 and coefficient == fixed: + fixed_private += bool((p[2] & 4) and (q[2] & 4)) + checked += 1 + require(set(counts) == nilpotents, "missing nilpotent target") + require(set(counts.values()) == {1 << n}, "wrong factorizations per target") + require(fixed_private == 0, "private-diagonal restriction failed") + for p, sign in product(projectors, (-1, 1)): + require(query_matrix(p, sign) not in targets.values(), "one query gives a shear") + reports.append({ + "rows": n, "projectors": len(projectors), "ordered_signed_pairs": checked, + "nonzero_rank_one_nilpotent_targets": len(nilpotents), + "solutions": sum(counts.values()), "solutions_per_target": 1 << n, + "solutions_by_left_right_sign": dict(sorted(by_sign.items())), + "fixed_data_shear_solutions_with_both_private_diagonals_one": fixed_private, + }) + + # Exhaust the *fixed* four native charts on (target, source, private). + # Stop at depth four, after completing the entire layer (not first success). + n, eye = 3, ident(3) + target = {0: mxor(eye, outer(1, 2, n)), 1: outer(1, 2, n)} + alphabet = [(a, b, s) for a, b, s in product((0, 1), (0, 1), (-1, 1))] + layers = [] + for length in range(5): + successes = 0 + for word in product(alphabet, repeat=length): + value = {0: eye} + for a, b, sign in word: + p = outer(4 | a, 4 | (b << 1), n) + value = pmul(query_matrix(p, sign), value) + successes += value == target + layers.append({"queries": length, "words": 8 ** length, "solutions": successes}) + require([x["solutions"] for x in layers] == [0, 0, 0, 0, 24], "native chart count") + return {"projector_pairs": reports, "native_chart_layers": layers} + + +def inverse_address(word): + result = [] + for event in reversed(word): + if event["op"] == "child": + result.append(deepcopy(event)) + else: + diagonal = F(event["diagonal"]) + result.append({ + "op": "affine", "dst": event["dst"], "diagonal": str(1 / diagonal), + "terms": [[i, str(-F(c) / diagonal)] for i, c in event["terms"]], + }) + return result + + +def specialize(q, modulus): + q = F(q) + if modulus is None: + return q + return q.numerator * pow(q.denominator, -1, modulus) % modulus + + +def address_apply(word, address, modulus=None): + z = list(address) + for event in word: + if event["op"] == "child": + i, j = event["fields"] + z[i], z[j] = z[j], z[i] + elif event["op"] == "affine": + i = event["dst"] + z[i] = specialize(event["diagonal"], modulus) * z[i] + sum( + specialize(c, modulus) * z[j] for j, c in event["terms"] + ) + if modulus is not None: + z[i] %= modulus + else: + raise CheckError("unknown ADDRESS operation") + return tuple(z) + + +S = (1, 0, 1, -1, 0, -1) +R = (1, 0, -1, -1, 0, 1) + + +def closed_address(address, sign, modulus=None): + amount = sum(r * x for r, x in zip(R, address)) * specialize(F(sign, 4), modulus) + z = [x + s * amount for x, s in zip(address[:6], S)] + list(address[6:]) + return tuple(x % modulus for x in z) if modulus else tuple(z) + + +def orbit(modulus, scale=1): + return [tuple(((scale if i == 0 else 0) + specialize(F(k * scale, 4), modulus) * S[i]) % modulus + for i in range(6)) for k in range(modulus // gcd(scale, modulus))] + + +def permutations(word, points, modulus): + lookup = {p: i for i, p in enumerate(points)} + require(len(lookup) == len(points), "orbit addresses repeat") + result = {} + for sign, w in ((1, word), (-1, inverse_address(word))): + push = [lookup[address_apply(w, p, modulus)] for p in points] + require(sorted(push) == list(range(len(points))), "ADDRESS map is not a permutation") + result[sign] = push + return result + + +def address_checks(packet): + word = packet["address_forward"] + require(Counter(e["op"] for e in word) == {"affine": 6, "child": 1}, "ADDRESS invoice") + for e in word: + if e["op"] == "affine": + require(all(0 <= i < e["dst"] < 6 for i, _ in e["terms"]), "unordered affine read") + diagonal = F(e["diagonal"]) + for v in (abs(diagonal.numerator), diagonal.denominator): + require(v > 0 and v & (v - 1) == 0, "diagonal excludes an odd prime") + for _, c in e["terms"]: + d = F(c).denominator + require(d & (d - 1) == 0, "coefficient excludes an odd prime") + else: + require(e["fields"] == [0, 5], "wrong recursive fields") + columns = 0 + moduli = (None, 3, 9, 27, 11, 121) + for m, sign, j in product(moduli, (-1, 1), range(8)): + column = tuple(int(i == j) for i in range(8)) + w = word if sign == 1 else inverse_address(word) + actual = address_apply(w, column, m) + require(actual == closed_address(column, sign, m), "rational/modular ADDRESS identity") + require(address_apply(inverse_address(w), actual, m) == column, "ADDRESS inverse") + columns += 1 + orbit_reports = [] + for m, scale in ((3, 1), (9, 1), (27, 1), (11, 1), (121, 1), (9, 3), (27, 3), (121, 11)): + points = orbit(m, scale) + maps = permutations(word, points, m) + size = len(points) + require(maps[1] == [(k + 1) % size for k in range(size)], "forward orientation") + require(maps[-1] == [(k - 1) % size for k in range(size)], "inverse orientation") + orbit_reports.append({"modulus": m, "initial_scale": scale, "length": size}) + return {"basis_columns_including_two_address_spectators": columns, + "rational_and_modular_domains": ["Q", 3, 9, 27, 11, 121], "orbits": orbit_reports} + + +def bit_apply(program, state, maps): + rows = [list(x) for x in state] + for e in program: + if e["op"] == "xor": + d, s = e["dst"], e["src"] + rows[d] = [a ^ b for a, b in zip(rows[d], rows[s])] + elif e["op"] == "copy": + rows[e["dst"]] = list(rows[e["src"]]) + elif e["op"] == "query": + row = e["row"] + out = [0] * len(rows[row]) + for old, new in enumerate(maps[e["direction"]]): + out[new] = rows[row][old] + rows[row] = out + elif e["op"] == "clear": + rows[e["row"]] = [0] * len(rows[e["row"]]) + else: + raise CheckError("unknown BIT operation") + return rows + + +def target_bit(state, clean=False): + # Independent expected endpoint: closed orbit shift, not the emitted maps. + out = [list(x) for x in state] + source = state[1] + out[0] = [x ^ y ^ source[(i - 1) % len(source)] + for i, (x, y) in enumerate(zip(state[0], source))] + if clean: + out[3] = [0] * len(source) + return out + + +def bit_identity(size): + # Each integer bit is a different input basis column. XOR transports all + # dirty columns simultaneously; there is no randomized VALUE sampling. + return [[1 << (r * size + k) for k in range(size)] for r in range(4)] + + +def invoice(program): + counts = Counter(e["op"] for e in program) + return {"ordinary_children": counts["query"], "ordered_affine_events": 6 * counts["query"], + "xor_scans": counts["xor"], "copy_scans": counts["copy"], "clear_scans": counts["clear"]} + + +def endpoint_checks(packet): + word, programs = packet["address_forward"], packet["programs"] + coverage = [] + for m, scale in ((3, 1), (9, 1), (27, 1), (11, 1), (121, 1), (9, 3), (27, 3), (121, 11)): + points = orbit(m, scale) + maps = permutations(word, points, m) + state = bit_identity(len(points)) + for name, program in programs.items(): + clean = name == "clean_private" + actual = bit_apply(program, state, maps) + require(actual == target_bit(state, clean), f"{name}: dirty endpoint failure") + twice = bit_apply(program, actual, maps) + expected = [list(x) for x in state] + if clean: + expected[3] = [0] * len(points) + require(twice == expected, f"{name}: completed DATA inverse failure") + coverage.append({"modulus": m, "initial_scale": scale, "dirty_basis_columns": 4 * len(points)}) + # Every assignment at an address fixed by h. No hidden nontrivial-orbit assumption. + fixed_checks = 0 + fixed_maps = {1: [0], -1: [0]} + fixed_address = (0, 1, 0, 0, 1, 0) + require(address_apply(word, fixed_address, 9) == fixed_address, "fixed address") + for bits, (name, program) in product(product((0, 1), repeat=4), programs.items()): + state = [[b] for b in bits] + expected = deepcopy(state) + if name == "clean_private": + expected[3] = [0] + require(bit_apply(program, state, fixed_maps) == expected, "fixed point VALUE failure") + fixed_checks += 1 + expected_invoices = { + "no_private": {"ordinary_children": 2, "ordered_affine_events": 12, "xor_scans": 2, "copy_scans": 0, "clear_scans": 0}, + "dirty_private": {"ordinary_children": 4, "ordered_affine_events": 24, "xor_scans": 5, "copy_scans": 0, "clear_scans": 0}, + "clean_private": {"ordinary_children": 1, "ordered_affine_events": 6, "xor_scans": 2, "copy_scans": 1, "clear_scans": 1}, + } + invoices = {name: invoice(p) for name, p in programs.items()} + require(invoices == expected_invoices, "paid-event census changed") + require(all(e.get("row") != 3 and e.get("dst") != 3 and e.get("src") != 3 + for e in programs["no_private"]), "private row used in no-private program") + for e in programs["dirty_private"]: + require((e["op"] == "query" and e["row"] == 3) + or (e["op"] == "xor" and (e["dst"], e["src"]) in {(3, 1), (0, 3), (0, 1)}), + "dirty-private program left the triangular query model") + return {"orbits": coverage, "basis_columns_per_program": sum(c["dirty_basis_columns"] for c in coverage), + "fixed_point_assignments_across_three_programs": fixed_checks, "invoices": invoices, + "clean_private_contract": "private input may be discarded; DATA and spectator input columns preserved as specified"} + + +def negative_controls(packet): + word, programs = packet["address_forward"], packet["programs"] + maps = permutations(word, orbit(11), 11) + state = bit_identity(11) + wanted = target_bit(state) + rejected = [] + for name, original in programs.items(): + for i, e in enumerate(original): + if e["op"] == "query": + mutated = deepcopy(original) + mutated.pop(i) + require(bit_apply(mutated, state, maps) != target_bit(state, name == "clean_private"), + "omitted query accepted") + rejected.append(f"{name}:omit_query_{i}") + wrong = deepcopy(programs["no_private"]) + wrong[0]["direction"] = 1 + require(bit_apply(wrong, state, maps) != wanted, "wrong inverse accepted") + rejected.append("no_private:use_forward_as_inverse") + for i in (1, 3): + wrong = deepcopy(programs["no_private"]) + wrong.pop(i) + require(bit_apply(wrong, state, maps) != wanted, "missing XOR accepted") + rejected.append(f"no_private:omit_xor_{i}") + clean = bit_apply(programs["clean_private"], state, maps) + require(clean != wanted, "owned scratch was accepted as restored arbitrary dirt") + rejected.append("clean_private:claim_arbitrary_dirty_restoration") + for i in (0, len(programs["clean_private"]) - 1): + wrong = deepcopy(programs["clean_private"]) + wrong.pop(i) + require(bit_apply(wrong, state, maps) != target_bit(state, True), "missing copy/clear accepted") + rejected.append(f"clean_private:omit_{programs['clean_private'][i]['op']}_{i}") + # Reproduce the distinction: the completed shear is self-inverse, but the + # unfinished dirty module's inverse does not undo a subsequent wipe. + dirty_module = [ + {"op": "xor", "dst": 3, "src": 1}, {"op": "xor", "dst": 0, "src": 3}, + {"op": "query", "row": 3, "direction": 1}, + {"op": "xor", "dst": 0, "src": 3}, {"op": "xor", "dst": 3, "src": 1}, + ] + inverse_module = [] + for e in reversed(dirty_module): + e = deepcopy(e) + if e["op"] == "query": + e["direction"] *= -1 + inverse_module.append(e) + clean_start = deepcopy(state) + clean_start[3] = [0] * 11 + forward = bit_apply(programs["clean_private"], clean_start, maps) + require(bit_apply(inverse_module, forward, maps) != clean_start, "erasure is reversible on dirty module") + rejected.append("clean_private:reuse_unfinished_module_inverse_after_clear") + # A scalar endpoint match cannot justify omitting its recursive child. + missing_child = [e for e in word if e["op"] != "child"] + column = (1, 0, 0, 0, 0, 0) + require(address_apply(missing_child, column) != closed_address(column, 1), "unpaid ADDRESS child accepted") + rejected.append("address:omit_ordinary_child_keep_affine_wrappers") + wrong = deepcopy(word) + wrong[2]["terms"][0][1] = "1" + require(address_apply(wrong, column) != closed_address(column, 1), "wrong ADDRESS coefficient accepted") + rejected.append("address:change_5_over_4_to_1") + # A concrete counterexample to extending the opposite-sign classification + # to order two: two same-sign queries can give a shear when t^2=1. + p, q, n = (1, 0), (3, 0), (2, 0) + same_sign = pmul(query_matrix(p, 1), query_matrix(q, 1)) + target = {0: mxor(ident(2), n), 1: n} + require(same_sign != target and cyclic_reduce(same_sign, 2) == cyclic_reduce(target, 2), + "order-two counterexample failed") + rejected.append("classification:extending_opposite_sign_rule_to_order_two") + return {"rejected": rejected, "count": len(rejected)} + + +def main(): + parser = argparse.ArgumentParser(description=__doc__) + action = parser.add_mutually_exclusive_group(required=True) + action.add_argument("--check", action="store_true") + action.add_argument("--write-results", action="store_true", help="regenerate EXPECTED.json locally") + parser.add_argument("-k", choices=("algebra", "address", "endpoints", "full_domain", "controls"), help="focused iteration") + args = parser.parse_args() + require(not (args.write_results and args.k), "partial results must not replace the complete receipt") + packet = json.loads((HERE / "PROGRAM.json").read_text()) + require(packet["schema"] == "native-restored-shear-v1", "packet schema") + require(packet["rows"] == ["target", "source", "spectator", "private"], "row labels") + require(set(packet["programs"]) == {"no_private", "dirty_private", "clean_private"}, "program inventory") + checks = {"algebra": lambda: algebra_checks(), "address": lambda: address_checks(packet), + "endpoints": lambda: endpoint_checks(packet), + "full_domain": lambda: runpy.run_path(str(HERE / "full_domain_check.py"))["check_full_domain"](packet), + "controls": lambda: negative_controls(packet)} + report = {name: f() for name, f in checks.items() if args.k is None or args.k == name} + destination = HERE / "EXPECTED.json" + if args.write_results: + destination.write_text(json.dumps(report, indent=2, sort_keys=True) + "\n") + print("WROTE EXPECTED.json (all five check groups)") + else: + expected = json.loads(destination.read_text()) + if args.k: + expected = {args.k: expected[args.k]} + require(report == expected, "computed evidence differs from EXPECTED.json") + print("PASS_RESTORED_SHEAR_INTERFACES" + (f" [{args.k}]" if args.k else "")) + if not args.k: + pairs = sum(r["ordered_signed_pairs"] for r in report["algebra"]["projector_pairs"]) + words = sum(r["words"] for r in report["algebra"]["native_chart_layers"]) + print(f"{pairs} signed projector pairs; {words} native-chart words; " + f"{report['endpoints']['basis_columns_per_program']} BIT basis columns per program; " + f"{report['controls']['count']} negative controls") + print("Independent full-domain replay: 729 addresses; 2916 basis columns per program; " + f"{report['full_domain']['endpoint_and_completed_inverse_cases']} endpoint/inverse cases") + + +if __name__ == "__main__": + try: + main() + except (CheckError, KeyError, ValueError, TypeError, OSError) as exc: + print(f"FAIL: {exc}", file=sys.stderr) + sys.exit(1) diff --git a/research/native-fusion-restored-shear/full_domain_check.py b/research/native-fusion-restored-shear/full_domain_check.py new file mode 100644 index 0000000000..c4beddaae1 --- /dev/null +++ b/research/native-fusion-restored-shear/full_domain_check.py @@ -0,0 +1,102 @@ +#!/usr/bin/env python3 +"""Separate sparse-set replay on every ADDRESS in (Z/3)^6. + +Apache-2.0; substantial OpenAI Codex assistance. No code is imported from +check.py. This finite linear-operator check is not a full theorem proof. +""" + +from fractions import Fraction +from itertools import product +import json +from pathlib import Path + + +def check_full_domain(packet): + modulus = 3 + addresses = list(product(range(modulus), repeat=6)) + + def scalar(text): + x = Fraction(text) + return x.numerator * pow(x.denominator, -1, modulus) % modulus + + def move(address): + value = list(address) + for operation in packet["address_forward"]: + if operation["op"] == "child": + i, j = operation["fields"] + value[i], value[j] = value[j], value[i] + elif operation["op"] == "affine": + i = operation["dst"] + value[i] = (scalar(operation["diagonal"]) * value[i] + + sum(scalar(c) * value[j] for j, c in operation["terms"])) % modulus + else: + raise ValueError("unknown ADDRESS operation") + return tuple(value) + + # A separate closed formula, in coordinates rather than matrix helpers. + def closed(address): + a, b, c, d, e, f = address + delta = (a - c - d + f) * pow(4, -1, modulus) + return ((a + delta) % modulus, b, (c + delta) % modulus, + (d - delta) % modulus, e, (f - delta) % modulus) + + forward = {address: move(address) for address in addresses} + if set(forward.values()) != set(addresses): + raise ValueError("full-domain ADDRESS map is not bijective") + if any(forward[a] != closed(a) for a in addresses): + raise ValueError("full-domain ADDRESS map disagrees with closed formula") + backward = {value: key for key, value in forward.items()} + + def execute(program, state): + rows = [set(s) for s in state] + for operation in program: + name = operation["op"] + if name == "xor": + rows[operation["dst"]].symmetric_difference_update(rows[operation["src"]]) + elif name == "copy": + rows[operation["dst"]] = set(rows[operation["src"]]) + elif name == "clear": + rows[operation["row"]] = set() + elif name == "query": + mapping = forward if operation["direction"] == 1 else backward + row = operation["row"] + rows[row] = {mapping[a] for a in rows[row]} + else: + raise ValueError("unknown BIT operation") + return rows + + counts = {} + for name, program in packet["programs"].items(): + checked = 0 + for row, address in product(range(4), addresses): + state = [set() for _ in range(4)] + state[row].add(address) + expected = [set(s) for s in state] + if row == 1: + expected[0].symmetric_difference_update({address}) + expected[0].symmetric_difference_update({closed(address)}) + if name == "clean_private": + expected[3] = set() + actual = execute(program, state) + if actual != expected: + raise ValueError(f"full-domain endpoint: {name}, input row {row}, address {address}") + restored = [set(s) for s in state] + if name == "clean_private": + restored[3] = set() + if execute(program, actual) != restored: + raise ValueError(f"full-domain completed inverse: {name}") + checked += 1 + counts[name] = checked + return { + "modulus": modulus, "full_address_count": len(addresses), + "fixed_addresses": sum(a == b for a, b in forward.items()), + "input_basis_columns_per_program": counts, + "endpoint_and_completed_inverse_cases": 2 * sum(counts.values()), + "method": "individual sparse-set BIT columns on the complete six-field address domain", + } + + +if __name__ == "__main__": + root = Path(__file__).resolve().parent + result = check_full_domain(json.loads((root / "PROGRAM.json").read_text())) + print(json.dumps(result, indent=2, sort_keys=True))