From 4cb255ef445e2abc3ff8845fa01210b974e2cf6c Mon Sep 17 00:00:00 2001 From: commdata2338 <199849969+commdata2338@users.noreply.github.com> Date: Tue, 13 Oct 2026 17:17:29 -0500 Subject: [PATCH] Research: audit selected PR589 pending projectors across all hosted helpers Independently reconstructs the frozen R439 bit allocation and checks its geometric binding across all 126,432 helper occurrences: the 14,208 physical families shared by different idle children have disjoint hosted supports, all 111 port projectors pass, and the paid histogram matches the selected receipt. An exact equal-rank substitution keeps counts, slots and windows but changes the address operator, so those checks alone do not imply the binding. No new kappa, supplier change or production acceptance bug. Adds research/selected-bit-hosting-audit/ only. Submitted by @commdata2338 with substantial AI assistance (OpenAI Codex research and implementation; packaged with Claude Code). --- research/selected-bit-hosting-audit/README.md | 221 ++++++++ .../selected-bit-hosting-audit/RESULT.json | 437 +++++++++++++++ .../selected-bit-hosting-audit/SOURCES.json | 102 ++++ research/selected-bit-hosting-audit/TASK.json | 78 +++ .../selected-bit-hosting-audit/VERIFY.json | 45 ++ .../selected-bit-hosting-audit/test_verify.py | 95 ++++ research/selected-bit-hosting-audit/verify.py | 520 ++++++++++++++++++ 7 files changed, 1498 insertions(+) create mode 100644 research/selected-bit-hosting-audit/README.md create mode 100644 research/selected-bit-hosting-audit/RESULT.json create mode 100644 research/selected-bit-hosting-audit/SOURCES.json create mode 100644 research/selected-bit-hosting-audit/TASK.json create mode 100644 research/selected-bit-hosting-audit/VERIFY.json create mode 100644 research/selected-bit-hosting-audit/test_verify.py create mode 100644 research/selected-bit-hosting-audit/verify.py diff --git a/research/selected-bit-hosting-audit/README.md b/research/selected-bit-hosting-audit/README.md new file mode 100644 index 0000000000..145a92501f --- /dev/null +++ b/research/selected-bit-hosting-audit/README.md @@ -0,0 +1,221 @@ +# Selected PR589 bit hosting: exact pending-projector audit + +**Finite geometric audit and scoped counterexample; no new kappa.** All +126,432 helper occurrences of the selected PR589 nine-stage R439 bit supplier +have disjoint physical pending supports, including 14,208 physical families +that host helpers from more than one idle child. The complete paid histogram +is independently recounted and agrees with the selected supplier receipt. + +An equal-rank coordinate substitution preserves the slot counts, within-child +disjointness and borrowing windows, but changes the exact bit address operator. +It is a counterexample to a deliberately weakened, count/window-only +geometric implication, **not an input accepted by the production pipeline**. +The source-bound level-to-axis interpretation supplies the missing constraint. + +Prepared for commdata2338 (@commdata2338), with substantial OpenAI Codex assistance. + +## Reproduce + +From the repository root, Python 3.12 and its standard library suffice: + +```sh +python3 -I -B research/selected-bit-hosting-audit/verify.py +python3 -I -B research/selected-bit-hosting-audit/test_verify.py +python3 scripts/research_package.py --package research/selected-bit-hosting-audit --check-only +python3 scripts/research_package.py --package research/selected-bit-hosting-audit +``` + +The first command checks [RESULT.json](RESULT.json) without rewriting it and +prints `PASS_SELECTED_BIT_HOSTING_AUDIT: 126432 helper occurrences; 111 port +projectors; 12 controls rejected`. The second runs six tests, including an +independent dense rational-matrix comparison. Both also work with `-O`. +To review intentional receipt changes, `verify.py --write NEW_PATH` writes +only a previously nonexistent file. No optimization, native build or download +is required. + +## Exact object and source boundary + +Base: `dadfea6e8a78ff6ba901705f87532a71c6f5bbb8`. At this base the selected +complex source is PR1094 `0fc329d0bec93ca7cd288eaea1295172e8789810`; its assembly +explicitly retains bit PR589 `a5afc8c6169ea61ba7c51dfd3cade02cc7b13b46`, merged +as `b3eb785ac5b4b1ca2beea0f80db078a505626a90`. The assembly's exact bit-receipt +blob and selected manifest hashes bind the tuned word, frozen selection and +receipt consumed here. Full pins are in [SOURCES.json](SOURCES.json). + +The finite domain is 111 live ports, 439 full-width-eight helper residuals per +call, nine stages, four pairs, 32 replicas and 64 ambient axes. No pending PR +is a code dependency. The scoped task card and next questions are also in +[TASK.json](TASK.json). + +| Recount | Result | +| --- | ---: | +| Controller events / idle children | 29 / 10, including one zero-rank child | +| Independently reconstructed slots per replica | 3,951 | +| Physical calls / helper occurrences | 288 / 126,432 | +| Physical families containing hosted helpers | 28,128 | +| Families hosting helpers from multiple idle children | 14,208 | +| Maximum helpers of one call sharing a physical family | 5 | +| Helper occurrences containing the entire local q-perp block | 21,312 | +| Live-port rational projectors / local frame dimensions | 111 / 636 | +| Recounted rank mass / deficit | 1,808,352 / 10,272 | + +The nonzero idle remainders are `{2:13920, 4:14208, 6:14208, 7:21312, +42:288}`. There are also 7,104 zero-rank remainders, all from the terminal +zero-rank child. Adding local transitions and nine rank-seven COPY charges +per call gives the complete histogram +`{1:381024, 2:400416, 3:22752, 4:26880, 5:29376, 6:17376, 7:26784, 42:288}`. +Reflection preserves each transition rank and COPY gap, so forward and +reflected calls have the same rank histogram. This recount does not replay +their scalar semantics or recertify the moment endpoint. + +## Pending-projector argument + +For any live root vector q, q^T q = 4. On the eight local coordinates put +`P_q = q q^T / 4` and `K_q = I_8 - P_q`. Direct rational multiplication checks +`K_q^2 = K_q`, `K_q q = 0` and `tr(K_q) = 7` at all 111 ports. Define exterior +seven-dimensional blocks `E_j`, for `j=1,...,8`. In a chart with q/2 first, +q-perp next, and the exterior coordinates last, the source level spaces are + +- `L_-1 = span(q)`; +- `L_a = Q^8 + E_1 + ... + E_a`, for `0 <= a <= 8` (orthogonal direct sums). + +An idle advance `a -> b` therefore has projector `P(L_b)-P(L_a)`. Its chart +axes are `[1, 8+7b)` when `a=-1`, and `[8+7a, 8+7b)` otherwise. Endpoints are +half-open. Replaying the source recipe's pair levels produces this table: + +| Child | Pair | Levels | Pending axes | Eligible local stages | +| ---: | ---: | --- | --- | --- | +| 0 | 1 | -1 to 1 | [1,15) | 0,1 | +| 1 | 1 | 1 to 2 | [15,22) | 2 | +| 2 | 2 | -1 to 3 | [1,29) | 0,1,2,3 | +| 3 | 2 | 3 to 4 | [29,36) | 4 | +| 4 | 3 | -1 to 5 | [1,43) | 0,1,2,3,4,5 | +| 5 | 3 | 5 to 6 | [43,50) | 6 | +| 6 | 0 | 2 to 8 | [22,64) | 3,4,5,6,7,8 | +| 7 | 1 | 4 to 8 | [36,64) | 5,6,7,8 | +| 8 | 2 | 6 to 8 | [50,64) | 7,8 | +| 9 | 3 | 8 to 8 | empty | none | + +For each physical family, distinct rows of this table have disjoint supports. +Inside each row, the frozen slots partition a subset of its ordered axes; +the remainder is the exact complement. This proves orthogonality of every +pair of hosted supports and of each support with its remaining child factor. + +**No orthonormal completion has to be chosen for these slots.** Every selected +slot contains either all seven q-perp axes or none of them; the same is true +of every child and remainder. Thus its actual projector is either `K_q` plus +an exterior coordinate projector, or just an exterior coordinate projector. +Changing the orthonormal basis of q-perp cannot change any of these projectors. +This observation is specific to this width-eight frozen selection; arbitrary +mixed-width slots can split q-perp and need additional basis data. + +For a projector P the inherited exact bit address operator is + +``` +D(P) = [ I-P P ] + [ P I-P ]. +``` + +If P and Q are orthogonal projectors, block multiplication gives +`D(P)D(Q) = D(P+Q)`. Induction proves that each child's hosted factors and +its remainder equal its original operator on **arbitrary head and tail +vectors**, not just sampled inputs. For commuting coordinate projectors +with overlap the formula is instead `D(P)D(Q) = D(P+Q-2PQ)`: repeated axes +cancel. The separate dense rational tests cover all two-coordinate support +pairs and show that noncommuting projectors cannot use the coordinate-set +argument. These tests accompany, rather than replace, the algebra above. + +## Counterexample and production protection + +On pair 1, child 0 contains exterior axis 8, while child 7 contains axis 36. +Conjugate **only child 7's realization**, including all its hosted slices and +remainder, by the ambient permutation exchanging axes 8 and 36. Its rank +stays 28; every slot width, relative offset, source stage, helper identity, +within-child disjointness and remainder rank stays unchanged. Its support +now overlaps child 0 at axis 8 and omits axis 36. + +The products of this family's idle factors before and after the substitution +differ on exactly these two exterior axes. Applied to `(head=e_8, tail=0)`, +the original product gives `(0,e_8)` and the modified product gives `(e_8,0)`. +This is an exact address-operator witness, independent of the port q. It is +not a replay of the whole interleaved supplier on that particular input; +local calls and bridges also occur between idle deadlines. At an individual +deadline the modified child operator already differs from the source operator. + +The production `audit_hosted_k.py` compares the schedule with the source +parent and validates relative slots under each child; `global_k.py` and +the geometry contract assign the actual pending subspaces from those levels. +Neither accepts an arbitrary alternate chart field of the kind introduced +in this adversarial fixture. `adapt9p.py` changes the live-port and COPY-rank +accounting, and PR545's adapter substitutes the live labels; it does not +grant arbitrary pending axes. These pinned constraints protect the selected +construction. The counterexample explains why a replacement geometric +compiler must preserve this binding, even if its rank and timing receipts +are unchanged. + +## Independence, controls and limits + +The audit independently implements backwards window scanning, direct +intervening-touch checks, finite allocation, ambient masks, all-replica +family checks and exact frame-rank/profile recounting. It compares allocation +and windows against the source's `expand` and `windows` functions. Only these +named pure functions, the source `recipe`, and the literal idle-table +construction are extracted with Python AST; entire producer modules, solvers +and original acceptance checkers are never imported. The source recipe and +geometric level convention are declared inputs, not independent discoveries. + +Twelve semantic controls reject equal-rank overlapping and wrong-disjoint +charts, duplicate axes, missing/duplicate helpers, distinct-helper overlap, +illegal stages, negative offsets, wrong width, out-of-replica copy indices, +an intervening bridge with stale windows, and a nonempty zero-rank child. +Six additional tests cover the positive receipt, independent dense matrix +composition, the noncommuting boundary, a split-q-perp rejection, changed +source bytes and a changed committed receipt. Checks remain active under `-O`. + +This is a finite geometric certificate with a written projector argument. +It does not prove the inherited complete-call correlated-helper realization, +injective cover-class compilation, local scalar correctness/H1-H5, all-size +compiler, native lowered program, precision/tape, analytic transfer, or the +full multiplication theorem. No complete cold replay, Lean proof, new moment +endpoint, supplier adoption or selected-frontier change is claimed. + +Nearby work is retained: [PR1228](https://github.com/CrocSwap/integer-mult-bounds/pull/1228) +and [PR1231](https://github.com/CrocSwap/integer-mult-bounds/pull/1231) derive two +pending ranges for one historical PR442 R747 invocation; this audit covers the +current PR589 R439 allocation and every idle child. [PR1209](https://github.com/CrocSwap/integer-mult-bounds/pull/1209) +and Josie Elliston's retained T16 owner audit treat the complex supplier. +[PR878](https://github.com/CrocSwap/integer-mult-bounds/pull/878) formalizes bit +B boundaries, not this global geometric census. No priority is claimed for +projector algebra, strict borrowing windows or the historical range formulas. +Sagar Thakrar's [PR589 width-packing audit](../bit589-width-packing/README.md) +already recounts the slot capacities and remainders and proves a restricted +width-eight packing optimum. Those counts are consistency checks here; the +added evidence is the current all-child projector census and the exact +rank/window-preserving geometric counterexample. + +## Open next questions + +1. Can the all-call pending-projector statement be connected to a typed + physical realization of the actual PR589 emitted word? This would reduce + the remaining gap between finite placement and complete-call hosting. + Start by exporting these source-bound slot masks into the PR540/PR1231 + multi-host contract with the R439 word. The missing current-word extraction + and correlated-helper realization remain blockers; historical Lean data + cannot simply be renamed. +2. Which mixed-width selected or proposed bit allocations split q-perp? + The completion-free argument would then require explicit local projectors. + First run the `mask & 255 in {0,254}` gate on one pinned candidate's slices; + if it fails, obtain the actual source orthonormal complement before testing + orthogonality. No such mixed-width source is admitted or excluded here. + +## Credit + +DreamingOfClouds / eumemic supplied PR589/555/545/543 and the punctured word, +interleaved interface, parameter adapters and retained replica chain. Zhihao +Chen supplied the PR386 bit geometry; DaysSky supplied PR442 idle-axis +hosting; chafreaky and the earlier bank/replica contributors supplied its +retained extensions. Their source notices and disclosed AI assistance remain +intact. The PR1228/1231 auditors and Josie Elliston's independent complex +owner audit provide nearby precedents. Rohan Arun's PR1094 supplies selected +context; it is unchanged. New material is Apache-2.0. This is AI-assisted +research and local checking, not independent human peer review. diff --git a/research/selected-bit-hosting-audit/RESULT.json b/research/selected-bit-hosting-audit/RESULT.json new file mode 100644 index 0000000000..b7e60b5fdb --- /dev/null +++ b/research/selected-bit-hosting-audit/RESULT.json @@ -0,0 +1,437 @@ +{ + "counterexample": { + "actual_head_axes": [ + 8 + ], + "actual_tail_axes": [], + "affected_axes": [ + 8, + 36 + ], + "axis_inserted": 8, + "axis_removed": 36, + "child": 7, + "expected_head_axes": [], + "expected_tail_axes": [ + 8 + ], + "family_pair": 1, + "input_head_axes": [ + 8 + ], + "input_tail_axes": [], + "overlapping_child": 0, + "strong_geometric_check": "reject", + "weak_count_window_check": "accept" + }, + "full_profile": { + "1": 381024, + "2": 400416, + "3": 22752, + "4": 26880, + "42": 288, + "5": 29376, + "6": 17376, + "7": 26784 + }, + "idle_children": [ + { + "axes": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11, + 12, + 13, + 14 + ], + "idx": 0, + "kind": "idle", + "legal_stages": [ + 0, + 1 + ], + "pair": 1, + "rank": 14, + "source_level": -1, + "target_level": 1 + }, + { + "axes": [ + 15, + 16, + 17, + 18, + 19, + 20, + 21 + ], + "idx": 1, + "kind": "idle", + "legal_stages": [ + 2 + ], + "pair": 1, + "rank": 7, + "source_level": 1, + "target_level": 2 + }, + { + "axes": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11, + 12, + 13, + 14, + 15, + 16, + 17, + 18, + 19, + 20, + 21, + 22, + 23, + 24, + 25, + 26, + 27, + 28 + ], + "idx": 2, + "kind": "idle", + "legal_stages": [ + 0, + 1, + 2, + 3 + ], + "pair": 2, + "rank": 28, + "source_level": -1, + "target_level": 3 + }, + { + "axes": [ + 29, + 30, + 31, + 32, + 33, + 34, + 35 + ], + "idx": 3, + "kind": "idle", + "legal_stages": [ + 4 + ], + "pair": 2, + "rank": 7, + "source_level": 3, + "target_level": 4 + }, + { + "axes": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11, + 12, + 13, + 14, + 15, + 16, + 17, + 18, + 19, + 20, + 21, + 22, + 23, + 24, + 25, + 26, + 27, + 28, + 29, + 30, + 31, + 32, + 33, + 34, + 35, + 36, + 37, + 38, + 39, + 40, + 41, + 42 + ], + "idx": 4, + "kind": "idle", + "legal_stages": [ + 0, + 1, + 2, + 3, + 4, + 5 + ], + "pair": 3, + "rank": 42, + "source_level": -1, + "target_level": 5 + }, + { + "axes": [ + 43, + 44, + 45, + 46, + 47, + 48, + 49 + ], + "idx": 5, + "kind": "idle", + "legal_stages": [ + 6 + ], + "pair": 3, + "rank": 7, + "source_level": 5, + "target_level": 6 + }, + { + "axes": [ + 22, + 23, + 24, + 25, + 26, + 27, + 28, + 29, + 30, + 31, + 32, + 33, + 34, + 35, + 36, + 37, + 38, + 39, + 40, + 41, + 42, + 43, + 44, + 45, + 46, + 47, + 48, + 49, + 50, + 51, + 52, + 53, + 54, + 55, + 56, + 57, + 58, + 59, + 60, + 61, + 62, + 63 + ], + "idx": 6, + "kind": "idle", + "legal_stages": [ + 3, + 4, + 5, + 6, + 7, + 8 + ], + "pair": 0, + "rank": 42, + "source_level": 2, + "target_level": 8 + }, + { + "axes": [ + 36, + 37, + 38, + 39, + 40, + 41, + 42, + 43, + 44, + 45, + 46, + 47, + 48, + 49, + 50, + 51, + 52, + 53, + 54, + 55, + 56, + 57, + 58, + 59, + 60, + 61, + 62, + 63 + ], + "idx": 7, + "kind": "idle", + "legal_stages": [ + 5, + 6, + 7, + 8 + ], + "pair": 1, + "rank": 28, + "source_level": 4, + "target_level": 8 + }, + { + "axes": [ + 50, + 51, + 52, + 53, + 54, + 55, + 56, + 57, + 58, + 59, + 60, + 61, + 62, + 63 + ], + "idx": 8, + "kind": "idle", + "legal_stages": [ + 7, + 8 + ], + "pair": 2, + "rank": 14, + "source_level": 6, + "target_level": 8 + }, + { + "axes": [], + "idx": 9, + "kind": "idle", + "legal_stages": [], + "pair": 3, + "rank": 0, + "source_level": 8, + "target_level": 8 + } + ], + "local_frames": 636, + "local_profile": { + "1": 1323, + "2": 1342, + "3": 79, + "4": 44, + "5": 102, + "6": 11, + "7": 19 + }, + "one_replica_slots": 3951, + "one_replica_slots_sha256": "13ebf06203985f4467ef60706d6cdf5c22ae4e00cc7d65628d28eba875cf2705", + "physical_census": { + "calls": 288, + "families_with_multiple_children": 14208, + "helper_occurrences": 126432, + "idle_remainder_histogram": { + "0": 7104, + "2": 13920, + "4": 14208, + "42": 288, + "6": 14208, + "7": 21312 + }, + "maximum_helpers_of_one_call_on_one_family": 5, + "occupied_physical_families": 28128, + "whole_q_perp_helper_occurrences": 21312 + }, + "port_projectors": 111, + "rejected_controls": [ + "equal_rank_cross_child_chart", + "equal_rank_disjoint_wrong_child", + "duplicate_axis_within_chart", + "omitted_helper", + "duplicate_helper", + "distinct_helper_same_child_overlap", + "call_outside_window", + "negative_slot_offset", + "rank_seven_helper", + "copy_outside_replica", + "intervening_touch_with_stale_windows", + "nonempty_zero_rank_child" + ], + "result_kind": "finite geometric audit with a weakened-implication counterexample", + "schedule_events": 29, + "scope": "No full native replay, arbitrary correlated-helper realization, all-size compiler, precision/tape, analytic transfer or new kappa.", + "slot_encoding": "JSON ordered six-integer rows; compact separators", + "source_hashes": { + "research/community-frontier1094-audit/ASSEMBLY.json": "1122cb3a575f8c788345fc1bf4c108ac7c3250fb81a5988671f5eb04b3ab3045", + "research/community-frontier1094-audit/SELECTED-SOURCE.json": "79b3de5db3dbcb9829789ba58e9e45758926031e2a7d80667a08429d369be53b", + "research/e8-bit-carrier-skeleton/code/nine/geometry.py": "36eeda3184bd009e89462b65c8725d10860c444f8da8f1f87e5f6e50120011ca", + "research/e8-bit-p111-tuned/code/adapt9p.py": "14365d0eb8f4a7352edd28816196148fd28d5bbcb36044ebeeb15ca051bca9de", + "research/e8-bit-p111-tuned/data/selection9-p111.json": "4ab1ed4529683cd184987f8bc3031fb7408b9cd22c25ab9cf541a8aaf896eaf1", + "research/e8-bit-p111-tuned/tune/EXPECTED.json": "b9f0e5ca038abe837b0007c8fe006f366a6f02009244ac57705a8a200e2301f4", + "research/e8-bit-p111-tuned/tune/bitE8mut-p111-tuned.json.gz": "e3e301e62bc2b41dbf1ceac0acf3d35824ebeab1848c5a2142d4577b109da52f", + "research/e8-bit-p111-tuned/vendor/pr510/e8-r480-nine-stage/vendor/e8-r715-eleven-stage-whole/code/audit_hosted_k.py": "57e558c80a2fea6e291587b04afd76dfaee3550729997798b61f33daf90b8ec9", + "research/e8-bit-p111-tuned/vendor/pr510/e8-r480-nine-stage/vendor/e8-r715-eleven-stage-whole/code/emit_k.py": "298b16c3d4f58a468ad1a64564c8500cb281414a3f3c0428fd467908eeb4a4b4", + "research/e8-bit-p111-tuned/vendor/pr510/e8-r480-nine-stage/vendor/e8-r715-eleven-stage-whole/code/global_k.py": "6368196a393ac25bb2918880e4c4bd31ed733b762c27b6873ab391cbc0c5c3c8", + "research/e8-bit-p111-tuned/vendor/pr510/e8-r480-nine-stage/vendor/e8-r715-eleven-stage-whole/code/hosting_k.py": "081c3b95b18d900d97ce82af64fb428f085b6adc6d8ca93ea920797dad7eb81e", + "research/e8-bit-p111-tuned/vendor/pr510/e8-r480-nine-stage/vendor/idle-axis-hosting/hosting_core.py": "d8b90cd5d152df3c7c351230863d9e61816ad5e1f21d69bea1a86a5daad559a3", + "research/e8-bit-p111-tuned/vendor/pr545/code/adapt.py": "b9a50303147a3003ad94fc4b1a822d4fca7f9b9e917d165e3c45152575302a0e", + "research/idle-axis-hosting/PROOF.md": "cfe34bf0b64259661312dae22c3a23adc5bf6f6326951eee5c1488ccfc347542" + }, + "status": "PASS_SELECTED_BIT_HOSTING_AUDIT" +} diff --git a/research/selected-bit-hosting-audit/SOURCES.json b/research/selected-bit-hosting-audit/SOURCES.json new file mode 100644 index 0000000000..f6902189e4 --- /dev/null +++ b/research/selected-bit-hosting-audit/SOURCES.json @@ -0,0 +1,102 @@ +{ + "schema_version": 1, + "base_commit": "dadfea6e8a78ff6ba901705f87532a71c6f5bbb8", + "files": [ + { + "path": "certificates/selected-result.json", + "usage": "provenance", + "git_blob": "ae6a99f28aa468649eb66a361e764d769363bf11", + "sha256": "10b9e340fd8e354a37a0c4813c90e5de1dd42044b5f6aca4a3fc5a42b685fa32" + }, + { + "path": "docs/research/agent-task-catalog.json", + "usage": "provenance", + "git_blob": "c05fafaa25ba95b2d5af86b1800427198e3d20eb", + "sha256": "89b5928bc92c81e2647b6d702a7ad85a6795b8f44e2eb267b2ff3145d8f2b2ce" + }, + { + "path": "research/community-frontier1094-audit/ASSEMBLY.json", + "usage": "input", + "git_blob": "5fd676df060f3b450782fdf5ff5f6beb63a5eeb0", + "sha256": "1122cb3a575f8c788345fc1bf4c108ac7c3250fb81a5988671f5eb04b3ab3045" + }, + { + "path": "research/community-frontier1094-audit/SELECTED-SOURCE.json", + "usage": "input", + "git_blob": "6a75493790b4eff9c4a98051ef8b01d6aad0d5a8", + "sha256": "79b3de5db3dbcb9829789ba58e9e45758926031e2a7d80667a08429d369be53b" + }, + { + "path": "research/e8-bit-carrier-skeleton/code/nine/geometry.py", + "usage": "input", + "git_blob": "91594e0223e8fac49162b5aef834ffaa8e94a254", + "sha256": "36eeda3184bd009e89462b65c8725d10860c444f8da8f1f87e5f6e50120011ca" + }, + { + "path": "research/e8-bit-p111-tuned/code/adapt9p.py", + "usage": "input", + "git_blob": "96bbc2ba9bb11984736e34db8b65c1a91e8f842e", + "sha256": "14365d0eb8f4a7352edd28816196148fd28d5bbcb36044ebeeb15ca051bca9de" + }, + { + "path": "research/e8-bit-p111-tuned/data/selection9-p111.json", + "usage": "input", + "git_blob": "e69ea66a3add357f570fc5552ab6368b3c8f9bb2", + "sha256": "4ab1ed4529683cd184987f8bc3031fb7408b9cd22c25ab9cf541a8aaf896eaf1" + }, + { + "path": "research/e8-bit-p111-tuned/tune/EXPECTED.json", + "usage": "input", + "git_blob": "e293ddc557742637f9f679f083a1a282d87b1b13", + "sha256": "b9f0e5ca038abe837b0007c8fe006f366a6f02009244ac57705a8a200e2301f4" + }, + { + "path": "research/e8-bit-p111-tuned/tune/bitE8mut-p111-tuned.json.gz", + "usage": "input", + "git_blob": "85a4499bf9e4911a705d50567a2c2ef6cf23739a", + "sha256": "e3e301e62bc2b41dbf1ceac0acf3d35824ebeab1848c5a2142d4577b109da52f" + }, + { + "path": "research/e8-bit-p111-tuned/vendor/pr510/e8-r480-nine-stage/vendor/e8-r715-eleven-stage-whole/code/audit_hosted_k.py", + "usage": "input", + "git_blob": "8864ca9b942a3507171edca0cf6cbaaf10fcf434", + "sha256": "57e558c80a2fea6e291587b04afd76dfaee3550729997798b61f33daf90b8ec9" + }, + { + "path": "research/e8-bit-p111-tuned/vendor/pr510/e8-r480-nine-stage/vendor/e8-r715-eleven-stage-whole/code/emit_k.py", + "usage": "input", + "git_blob": "b84c795a045143639efe6aefb0562b3c20a2c9d7", + "sha256": "298b16c3d4f58a468ad1a64564c8500cb281414a3f3c0428fd467908eeb4a4b4" + }, + { + "path": "research/e8-bit-p111-tuned/vendor/pr510/e8-r480-nine-stage/vendor/e8-r715-eleven-stage-whole/code/global_k.py", + "usage": "input", + "git_blob": "3df12bd632f1fdba825ced57110a1fee82eb2857", + "sha256": "6368196a393ac25bb2918880e4c4bd31ed733b762c27b6873ab391cbc0c5c3c8" + }, + { + "path": "research/e8-bit-p111-tuned/vendor/pr510/e8-r480-nine-stage/vendor/e8-r715-eleven-stage-whole/code/hosting_k.py", + "usage": "input", + "git_blob": "02fea8320b676e14f8ffa242c3ddfa85fa829e31", + "sha256": "081c3b95b18d900d97ce82af64fb428f085b6adc6d8ca93ea920797dad7eb81e" + }, + { + "path": "research/e8-bit-p111-tuned/vendor/pr510/e8-r480-nine-stage/vendor/idle-axis-hosting/hosting_core.py", + "usage": "input", + "git_blob": "68b536daa9e6546c0aa046934bf840aaa3c3fde3", + "sha256": "d8b90cd5d152df3c7c351230863d9e61816ad5e1f21d69bea1a86a5daad559a3" + }, + { + "path": "research/e8-bit-p111-tuned/vendor/pr545/code/adapt.py", + "usage": "input", + "git_blob": "bd1552af18ae259c01039627aa06006b9d5e760f", + "sha256": "b9a50303147a3003ad94fc4b1a822d4fca7f9b9e917d165e3c45152575302a0e" + }, + { + "path": "research/idle-axis-hosting/PROOF.md", + "usage": "input", + "git_blob": "4468a00349b4f68dce103e785a8392099435e1d6", + "sha256": "cfe34bf0b64259661312dae22c3a23adc5bf6f6326951eee5c1488ccfc347542" + } + ] +} diff --git a/research/selected-bit-hosting-audit/TASK.json b/research/selected-bit-hosting-audit/TASK.json new file mode 100644 index 0000000000..b5200f74fa --- /dev/null +++ b/research/selected-bit-hosting-audit/TASK.json @@ -0,0 +1,78 @@ +{ + "schema_version": 1, + "task_id": "supplier-boundary-audit", + "priority_revision": 2, + "base_commit": "dadfea6e8a78ff6ba901705f87532a71c6f5bbb8", + "original_card": { + "id": "supplier-boundary-audit", + "question": "Does one selected supplier obligation follow from its actual source-bound checks?", + "starting_points": [ + "certificates/selected-result.json", + "research/owner-boundary-audit/README.md" + ], + "methods": [ + "Trace one hypothesis through the source, checker and complete caller.", + "Construct one semantically invalid but superficially well-formed fixture and test rejection." + ], + "acceptance_gate": "Pin the current sources and one obligation; the historical owner audit is an example, not evidence of a current bug.", + "first_step": { + "command": [ + "python3", + "-B", + "research/owner-boundary-audit/verify.py" + ], + "expected": "PASS_PR626_NEXT_TOUCH_BOUNDARY_AUDIT", + "inspect": "Identify why the timing-only omission passes but the full production controller still rejects it.", + "scope": "Positive control / source-bound orientation only; this is not a new construction or full cold replay." + }, + "first_experiment": "Choose one current supplier obligation and trace whether its acceptance depends on an independent check.", + "bottleneck_link": "Closing a current acceptance gap or proof obligation strengthens reliability even without changing kappa.", + "allowed_variations": [ + "Audit one named current condition using a new semantic counterexample." + ], + "scope_change_triggers": [ + "Reporting the historical timing-only diagnostic as a new current acceptance bug." + ], + "overlap_terms": [ + "owner boundary", + "bridge omission", + "hosting" + ] + }, + "scope_status": "refined", + "actual_scope": "Current PR589 nine-stage R439 bit hosting: source-bound pending projectors across every idle child, 111 ports and all 32 replicas; rank/window-preserving false geometric realization.", + "scope_change_reason": "Select one current supplier geometric implication, distinct from the historical PR626 bridge audit and concurrent complex audits; existing source binding is explicitly retained as production protection.", + "bottleneck_link": "Independently verify a finite geometric premise of selected bit hosting and show what an alternate compiler must preserve. No supplier, recursive profile or kappa improvement is claimed.", + "budget_minutes": 60, + "stop_rule": "Stop after the fixed ten-child/3951-slot-per-replica census, exact projector argument, counterexample and controls. No widened search or supplier adoption.", + "outcome": "completed", + "evidence": "RESULT.json; verify.py source/geometry/profile replay and 12 rejection controls; test_verify.py independent rational matrices and source/receipt faults. README states exact limits.", + "author": "commdata2338", + "ai_assistance": "Prepared for commdata2338 (@commdata2338), with substantial OpenAI Codex assistance. No independent human peer review or external agent review claimed.", + "open_questions": [ + { + "question": "Connect the current all-call pending-projector statement to a typed physical realization of the actual PR589 word.", + "why_it_matters": "Finite placement alone does not establish complete-call correlated-helper hosting.", + "first_step": "Export these source-bound masks and the current R439 word into the PR540/PR1231 multi-host contract, preserving exact source identities.", + "blocked_by": "Current-word extraction and the physical correlated-helper realization; historical Lean data cannot simply be renamed." + }, + { + "question": "Which mixed-width bit allocations split the local q-perp block?", + "why_it_matters": "Such slices are outside the completion-free projector argument and need explicit basis data.", + "first_step": "Apply the low-eight-axis mask gate to one pinned candidate; if it splits q-perp obtain the source orthonormal complement and check actual projector products.", + "blocked_by": "A specified mixed-width candidate and its exact source chart; none is admitted or excluded here." + } + ], + "chooser": { + "nonce": "a5c234473782f78e2b63b17f1efbf42b", + "track": "adversarial-audit", + "scope_key": "dcdb0fa8e49b08a958d0", + "other_suggestion": { + "task_id": "uniform-transfer-audit", + "scope_key": "ce7411fb7cf6f3460bfc", + "reason_passed_over": "Active discussion1260 covers selected complex precision; the finite bit premise is distinct and bounded." + } + }, + "discussion": "https://github.com/CrocSwap/integer-mult-bounds/discussions/1289", + "coordination": "Claim posted in discussion #1289 by the submitting account; the agent session itself made no GitHub writes." +} diff --git a/research/selected-bit-hosting-audit/VERIFY.json b/research/selected-bit-hosting-audit/VERIFY.json new file mode 100644 index 0000000000..a303452875 --- /dev/null +++ b/research/selected-bit-hosting-audit/VERIFY.json @@ -0,0 +1,45 @@ +{ + "schema_version": 1, + "status": "ready", + "python": "3.12", + "requirements": [], + "inputs": [ + "research/community-frontier1094-audit/ASSEMBLY.json", + "research/community-frontier1094-audit/SELECTED-SOURCE.json", + "research/e8-bit-carrier-skeleton/code/nine/geometry.py", + "research/e8-bit-p111-tuned/code/adapt9p.py", + "research/e8-bit-p111-tuned/data/selection9-p111.json", + "research/e8-bit-p111-tuned/tune/EXPECTED.json", + "research/e8-bit-p111-tuned/tune/bitE8mut-p111-tuned.json.gz", + "research/e8-bit-p111-tuned/vendor/pr510/e8-r480-nine-stage/vendor/e8-r715-eleven-stage-whole/code/audit_hosted_k.py", + "research/e8-bit-p111-tuned/vendor/pr510/e8-r480-nine-stage/vendor/e8-r715-eleven-stage-whole/code/emit_k.py", + "research/e8-bit-p111-tuned/vendor/pr510/e8-r480-nine-stage/vendor/e8-r715-eleven-stage-whole/code/global_k.py", + "research/e8-bit-p111-tuned/vendor/pr510/e8-r480-nine-stage/vendor/e8-r715-eleven-stage-whole/code/hosting_k.py", + "research/e8-bit-p111-tuned/vendor/pr510/e8-r480-nine-stage/vendor/idle-axis-hosting/hosting_core.py", + "research/e8-bit-p111-tuned/vendor/pr545/code/adapt.py", + "research/idle-axis-hosting/PROOF.md" + ], + "commands": [ + { + "argv": [ + "{python}", + "-I", + "-B", + "{package}/verify.py" + ], + "timeout_seconds": 120, + "checks": "Source pins, finite pending projector/slot/chronology/profile audit, exact receipt and 12 semantic rejection controls." + }, + { + "argv": [ + "{python}", + "-I", + "-O", + "-B", + "{package}/test_verify.py" + ], + "timeout_seconds": 120, + "checks": "Six tests: positive receipt, independent dense rational D-projector algebra, noncommuting and split-complement boundaries, tampered source and receipt rejection; optimized mode." + } + ] +} diff --git a/research/selected-bit-hosting-audit/test_verify.py b/research/selected-bit-hosting-audit/test_verify.py new file mode 100644 index 0000000000..29f4779f23 --- /dev/null +++ b/research/selected-bit-hosting-audit/test_verify.py @@ -0,0 +1,95 @@ +"""Independent matrix algebra and rejection controls for the finite audit. + +Prepared for commdata2338 with substantial OpenAI Codex assistance. Apache-2.0. +""" +from contextlib import redirect_stdout +from fractions import Fraction as Q +import importlib.util +import io +import json +from pathlib import Path +import tempfile +import unittest +from unittest.mock import patch + +PACKAGE = Path(__file__).resolve().parent +spec = importlib.util.spec_from_file_location("hosting_audit", PACKAGE / "verify.py") +audit = importlib.util.module_from_spec(spec) +spec.loader.exec_module(audit) + + +def multiply(a, b): + return [[sum(x * y for x, y in zip(row, col)) for col in zip(*b)] for row in a] + + +def operator(p): + """Dense rational D(P), independently of the verifier's bit-mask operation.""" + n = len(p) + complement = [[Q(i == j) - p[i][j] for j in range(n)] for i in range(n)] + return [complement[i] + p[i] for i in range(n)] + [p[i] + complement[i] for i in range(n)] + + +def diagonal(bits): + return [[Q(i == j and (bits >> i) & 1) for j in range(2)] for i in range(2)] + + +class AuditTests(unittest.TestCase): + def test_complete_finite_receipt(self): + expected = json.loads((PACKAGE / "RESULT.json").read_text()) + self.assertEqual(audit.verify(), expected) + self.assertEqual(len(expected["rejected_controls"]), 12) + + def test_disjoint_union_vs_overlapping_symmetric_difference(self): + for p in range(4): + for q in range(4): + actual = multiply(operator(diagonal(p)), operator(diagonal(q))) + self.assertEqual(actual, operator(diagonal(p ^ q))) + if p & q: + self.assertNotEqual(actual, operator(diagonal(p | q))) + else: + self.assertEqual(actual, operator(diagonal(p | q))) + for basis_column in range(4): + head = (1 << basis_column) if basis_column < 2 else 0 + tail = (1 << (basis_column - 2)) if basis_column >= 2 else 0 + h, t = audit.d_apply(p, *audit.d_apply(q, head, tail)) + dense = [actual[i][basis_column] for i in range(4)] + self.assertEqual(dense, [Q((h >> i) & 1) for i in range(2)] + + [Q((t >> i) & 1) for i in range(2)]) + + def test_noncommuting_projectors_are_not_coordinate_factors(self): + p = diagonal(1) + q = [[Q(1, 2), Q(1, 2)], [Q(1, 2), Q(1, 2)]] + self.assertEqual(multiply(q, q), q) + self.assertNotEqual(multiply(p, q), multiply(q, p)) + self.assertNotEqual(multiply(operator(p), operator(q)), multiply(operator(q), operator(p))) + + def test_split_q_perp_is_outside_the_completion_free_argument(self): + with self.assertRaisesRegex(audit.Reject, "whole q-perp"): + audit.port_projectors({"lines": []}, [(0, 0, 0, 0, 1 << 1)], {}) + + def test_changed_source_bytes_rejected_before_computation(self): + pins = json.loads((PACKAGE / "SOURCES.json").read_text()) + source = next(p for p in pins["files"] if p["usage"] == "input") + with tempfile.TemporaryDirectory(prefix="bit-host-source-", dir=PACKAGE) as folder: + root = Path(folder) + target = root / source["path"] + target.parent.mkdir(parents=True) + target.write_bytes((audit.ROOT / source["path"]).read_bytes() + b" ") + with patch.object(audit, "ROOT", root): + with self.assertRaisesRegex(audit.Reject, "source hash"): + audit.source_bindings() + + def test_changed_committed_receipt_rejected_by_cli(self): + with tempfile.TemporaryDirectory(prefix="bit-host-receipt-", dir=PACKAGE) as folder: + package = Path(folder) + (package / "SOURCES.json").write_bytes((PACKAGE / "SOURCES.json").read_bytes()) + receipt = json.loads((PACKAGE / "RESULT.json").read_text()) + receipt["physical_census"]["helper_occurrences"] -= 1 + (package / "RESULT.json").write_text(json.dumps(receipt)) + with patch.object(audit, "PACKAGE", package), patch("sys.argv", ["verify.py"]): + with redirect_stdout(io.StringIO()), self.assertRaisesRegex(SystemExit, "receipt mismatch"): + audit.main() + + +if __name__ == "__main__": + unittest.main() diff --git a/research/selected-bit-hosting-audit/verify.py b/research/selected-bit-hosting-audit/verify.py new file mode 100644 index 0000000000..5c227bfa63 --- /dev/null +++ b/research/selected-bit-hosting-audit/verify.py @@ -0,0 +1,520 @@ +#!/usr/bin/env python3 +"""Finite PR589 pending-axis audit; standard library, no supplier admission claim. + +Prepared for commdata2338, with substantial OpenAI Codex assistance. +Apache-2.0. Source algorithm/geometry credit is recorded in README.md. +""" +import argparse +import ast +from collections import Counter, defaultdict +from copy import deepcopy +from fractions import Fraction as Q +import gzip +import hashlib +import json +from pathlib import Path + +PACKAGE = Path(__file__).resolve().parent +ROOT = PACKAGE.parents[1] +BIT = "research/e8-bit-p111-tuned/" +VENDOR = BIT + "vendor/pr510/e8-r480-nine-stage/vendor/" +CONTROLLER = VENDOR + "e8-r715-eleven-stage-whole/code/global_k.py" +HOSTING = VENDOR + "idle-axis-hosting/hosting_core.py" +GEOMETRY = "research/e8-bit-carrier-skeleton/code/nine/geometry.py" +V, R, REPLICAS, STAGES, DIM = 111, 439, 32, 9, 64 + + +class Reject(ValueError): + pass + + +def need(condition, message): + if not condition: + raise Reject(message) + + +def digest(data): + return hashlib.sha256(data).hexdigest() + + +def canonical(value): + return json.dumps(value, sort_keys=True, separators=(",", ":")).encode() + + +def read_json(path): + return json.loads((ROOT / path).read_text()) + + +def source_bindings(): + pins = json.loads((PACKAGE / "SOURCES.json").read_text()) + hashes = {} + for item in pins["files"]: + if item["usage"] == "input": + raw = (ROOT / item["path"]).read_bytes() + need(digest(raw) == item["sha256"], "source hash: " + item["path"]) + blob = hashlib.sha1(b"blob " + str(len(raw)).encode() + b"\0" + raw).hexdigest() + need(blob == item["git_blob"], "source blob: " + item["path"]) + hashes[item["path"]] = digest(raw) + selected = read_json("research/community-frontier1094-audit/SELECTED-SOURCE.json")["files"] + for path in (BIT + "tune/EXPECTED.json", BIT + "tune/bitE8mut-p111-tuned.json.gz", + BIT + "data/selection9-p111.json"): + need(selected[path] == hashes[path], "selected bit input binding") + assembly = read_json("research/community-frontier1094-audit/ASSEMBLY.json") + need(assembly["bit_supplier"]["commit"] == "a5afc8c6169ea61ba7c51dfd3cade02cc7b13b46", + "selected PR589 source head") + need(assembly["bit_supplier"]["git_blob_sha1"] == next( + p["git_blob"] for p in pins["files"] if p["path"] == BIT + "tune/EXPECTED.json"), + "selected bit receipt blob") + return hashes + + +def source_function(path, name): + """Execute only a named, pinned pure function; no module imports/main/solver. + + Source recipe is an input. Source windows/expand are comparison oracles only; + neither computes the audit's masks, timing predicate or allocation. + """ + tree = ast.parse((ROOT / path).read_text()) + nodes = [n for n in tree.body if isinstance(n, ast.FunctionDef) and n.name == name] + need(len(nodes) == 1, "unique source function " + name) + namespace = {"Counter": Counter, "defaultdict": defaultdict} + exec(compile(ast.Module(body=nodes, type_ignores=[]), path, "exec"), namespace) + return namespace[name] + + +def source_idle_table(): + """Extract only the literal idle-table construction from pinned geometry.main. + + No sympy, port compiler or other geometry code is executed. Exact equality + with these source entries binds the independently replayed level evolution. + """ + tree = ast.parse((ROOT / GEOMETRY).read_text()) + main = next(n for n in tree.body if isinstance(n, ast.FunctionDef) and n.name == "main") + start = next(i for i, n in enumerate(main.body) if isinstance(n, ast.Assign) + and any(isinstance(t, ast.Name) and t.id == "idle" for t in n.targets)) + nodes = main.body[start:start + 3] + need(isinstance(nodes[0], ast.Assign) and all(isinstance(n, ast.For) for n in nodes[1:]), + "source idle-table syntax") + namespace = {} + exec(compile(ast.Module(body=nodes, type_ignores=[]), GEOMETRY, "exec"), namespace) + return namespace["idle"] + + +def controller(): + """Replay levels, including zero-rank terminal child, in source chronology.""" + recipe = source_function(CONTROLLER, "recipe")(4) + levels = [-1] * 4 + events, children = [], [] + + def advance(pair, target): + old = levels[pair] + need(-1 <= old <= target <= 8, "monotone idle levels") + child = dict(kind="idle", idx=len(children), pair=pair, + source_level=old, target_level=target, rank=7 * (target - old)) + events.append(child) + children.append(child) + levels[pair] = target + + for event in recipe: + kind = event["kind"] + if kind == "local": + stage, pair = event["stage"], event["pair"] + need(levels[pair] == stage - 1, "local entry level") + levels[pair] = stage + events.append(event) + if 1 <= stage <= 6: + advance((stage + 1) // 2, stage) + if stage == 8: + for other in range(4): + advance(other, 8) + elif kind == "bridge": + need(levels[event["dst"]] == levels[event["src"]], "bridge levels") + events.append(event) + else: + need(kind == "exchange" and levels == [8] * 4, "terminal exchange") + events.append(event) + keys = ("pair", "source_level", "target_level", "rank") + need([[c[k] for k in keys] for c in children] == + [[c[k] for k in keys] for c in source_idle_table()], "source idle-table agreement") + need(len(children) == 10 and sum(c["rank"] for c in children) == 189, + "ten children, including zero-rank terminal") + return events, children + + +def pending_axes(child): + a, b = child["source_level"], child["target_level"] + need(-1 <= a <= b <= 8, "pending level domain") + # Chart axis 0 is q/2, axes 1..7 are q-perp, E_j = [8+7(j-1),8+7j). + return tuple(range(1 if a == -1 else 8 + 7 * a, 8 + 7 * b)) + + +def backwards_windows(events, children): + answer = {} + for child in children: + position = events.index(child) + pair = child["pair"] + stages = [] + for event in reversed(events[:position]): + if event["kind"] == "local": + if event["pair"] == pair: + break + stages.append(event["stage"]) + elif event["kind"] == "bridge" and pair in (event["src"], event["dst"]): + break + answer[child["idx"]] = (pair, child["rank"], frozenset(stages)) + return answer + + +def allocate(selection, windows): + """Independent finite expansion of the frozen pattern/stage demand table.""" + patterns = defaultdict(list) + for child, widths, copies in selection["patterns"]: + need(child in windows and copies > 0 and all(w == 8 for w in widths), "pattern domain") + patterns[child].append((tuple(widths), copies)) + demand = defaultdict(Counter) + seen = set() + for child, width, stage, count in selection["stages"]: + need((child, width, stage) not in seen, "duplicate stage demand") + seen.add((child, width, stage)) + need(child in windows and stage in windows[child][2] and width == 8 and count > 0, + "stage demand outside window or width") + demand[child][stage] = count + next_helper = Counter() + slots, remainders = [], {} + for child, (_, child_rank, _) in sorted(windows.items()): + copy = 0 + for widths, count in sorted(patterns[child], key=lambda p: (-sum(p[0]), p[0])): + need(sum(widths) <= child_rank, "pattern exceeds child") + for _ in range(count): + need(copy < 2 * V, "too many copies") + offset = 0 + for width in sorted(widths, reverse=True): + candidates = [s for s, n in demand[child].items() if n > 0] + need(candidates, "missing stage supply") + stage = min(candidates) + helper = next_helper[stage] + need(helper < R, "helper supply exhausted") + next_helper[stage] += 1 + demand[child][stage] -= 1 + slots.append((child, copy, offset, width, stage, helper)) + offset += width + remainders[child, copy] = child_rank - offset + copy += 1 + while copy < 2 * V: + remainders[child, copy] = child_rank + copy += 1 + need(not any(demand[child].values()), "unused stage supply") + need(dict(next_helper) == {s: R for s in range(STAGES)}, "all helper occurrences allocated") + return slots, remainders + + +def mask(axes): + axes = tuple(axes) + need(all(type(a) is int and 0 <= a < DIM for a in axes) and len(set(axes)) == len(axes), + "ambient axes distinct and bounded") + return sum(1 << a for a in axes) + + +def check_children(children, charts, strong=True): + families = defaultdict(int) + for child in children: + axes = charts[child["idx"]] + current = mask(axes) + need(len(axes) == child["rank"], "child rank") + if strong: + need(not families[child["pair"]] & current, "cross-child physical overlap") + families[child["pair"]] |= current + if strong: + for child in children: + need(tuple(charts[child["idx"]]) == pending_axes(child), "source pending-axis binding") + return dict(families) + + +def audit_slots(events, children, windows, slots, charts, strong=True): + check_children(children, charts, strong) + used = defaultdict(int) + helpers = set() + call_position = {e["stage"]: i for i, e in enumerate(events) if e["kind"] == "local"} + deadline = {e["idx"]: i for i, e in enumerate(events) if e["kind"] == "idle"} + calls = {e["stage"]: e for e in events if e["kind"] == "local"} + role_masks = [] + for child, copy, offset, width, stage, helper in slots: + need(child in windows and 0 <= copy < 2 * V and 0 <= stage < STAGES and 0 <= helper < R, + "slot indices") + need((stage, helper) not in helpers, "duplicate helper") + helpers.add((stage, helper)) + need(width == 8 and 0 <= offset and offset + width <= len(charts[child]), "slot extent") + pair = children[child]["pair"] + need(stage in windows[child][2] and calls[stage]["pair"] != pair, "slot window") + begin, end = call_position[stage], deadline[child] + need(begin < end, "call before deadline") + # Direct chronology, separate from the reverse-scan window predicate. + for event in events[begin + 1:end]: + need(not (event["kind"] == "local" and event["pair"] == pair), "intervening local touch") + need(not (event["kind"] == "bridge" and pair in (event["src"], event["dst"])), + "intervening bridge touch") + active = mask(charts[child][offset:offset + width]) + need(not active & used[child, copy], "within-child slot overlap") + used[child, copy] |= active + role_masks.append((child, copy, stage, helper, active)) + need(helpers == {(s, h) for s in range(STAGES) for h in range(R)}, "helper coverage") + remainder = {} + for child in children: + whole = mask(charts[child["idx"]]) + for copy in range(2 * V): + taken = used[child["idx"], copy] + need(taken & ~whole == 0, "slot inside child") + rest = whole ^ taken + need(not taken & rest and (taken ^ rest) == whole, "exact remainder factorization") + remainder[child["idx"], copy] = rest.bit_count() + return role_masks, remainder + + +def rank(rows): + work = [[Q(x) for x in row] for row in rows] + pivot = 0 + for col in range(8): + found = next((i for i in range(pivot, len(work)) if work[i][col]), None) + if found is None: + continue + work[pivot], work[found] = work[found], work[pivot] + lead = work[pivot][col] + work[pivot] = [x / lead for x in work[pivot]] + for i in range(pivot + 1, len(work)): + if work[i][col]: + coefficient = work[i][col] + work[i] = [x - coefficient * y for x, y in zip(work[i], work[pivot])] + pivot += 1 + if pivot == len(work): + break + return pivot + + +def local_profile(word): + """Recount frame transitions and COPY charges, not scalar/operator semantics.""" + need((word["h"], word["v"], word["R"]) == (8, V, R), "word header") + dims = [rank([word["lines"][i] for i in frame]) for frame in word["frames"]] + current = word["start"][:] + need(len(current) == 2 * V + R and all(dims[f] == 0 for f in current[2 * V:]), + "width-eight helper entrances") + profile = Counter() + + def climb(register, frame): + old = current[register] + if old != frame: + need(dims[frame] > dims[old], "strict frame climb") + need(set(word["frames"][old]) <= set(word["frames"][frame]), "nested closed frames") + profile[dims[frame] - dims[old]] += 1 + current[register] = frame + + copies = [] + for section in ("D", "A", "scatter", "B", "C"): + if section == "scatter": + copies = [dims[current[helper]] for helper in word["ret"]] + profile.update(copies) + continue + for frame, destination, sources in word[section]: + for register in (destination, *sources): + climb(register, frame) + for register, frame in enumerate(word["final"]): + climb(register, frame) + need(copies == [7] * 9, "nine rank-seven copies") + need(all(dims[word["final"][r]] == 8 for r in range(2 * V, 2 * V + R)), "full helper exits") + return profile, dims + + +def port_projectors(word, role_masks, charts): + # In this selection q-perp is never split. Its projector K_q suffices; + # no particular orthonormal completion of q/2 enters this calculation. + all_masks = [m for *_, m in role_masks] + [mask(c) for c in charts.values()] + need(all((m & 255) in (0, 254) for m in all_masks), "whole q-perp local component") + used = defaultdict(int) + for child, copy, _, _, support in role_masks: + used[child, copy] |= support + need(all(((mask(axes) ^ used[child, copy]) & 255) in (0, 254) + for child, axes in charts.items() for copy in range(2 * V)), + "whole q-perp remainder component") + need(len(word["lines"]) == V, "all live ports") + for q in word["lines"]: + need(len(q) == 8 and sum(x*x for x in q) == 4, "port norm") + P = [[Q(q[i] * q[j], 4) for j in range(8)] for i in range(8)] + K = [[Q(i == j) - P[i][j] for j in range(8)] for i in range(8)] + need(all(sum(K[i][k] * K[k][j] for k in range(8)) == K[i][j] + for i in range(8) for j in range(8)), "q-perp idempotence") + need(all(sum(K[i][j] * q[j] for j in range(8)) == 0 for i in range(8)), "q-perp kernel") + need(sum(K[i][i] for i in range(8)) == 7, "q-perp rank") + return len(word["lines"]) + + +def physical_census(children, roles, remainders): + seen_roles = set() + family_masks = defaultdict(int) + family_children = defaultdict(set) + call_families = Counter() + for replica in range(REPLICAS): + for child, copy, stage, helper, active in roles: + family = replica * (8 * V) + 2 * children[child]["pair"] * V + copy + need(0 <= family < 8 * V * REPLICAS, "physical family bounds") + key = (replica, stage, helper) + need(key not in seen_roles, "physical role alias") + seen_roles.add(key) + need(not family_masks[family] & active, "physical slot overlap across children/calls") + family_masks[family] |= active + family_children[family].add(child) + call_families[replica, stage, family] += 1 + need(len(seen_roles) == REPLICAS * STAGES * R, "all physical roles") + return dict(helper_occurrences=len(seen_roles), calls=REPLICAS * STAGES, + whole_q_perp_helper_occurrences=REPLICAS * sum((m & 255) == 254 for *_, m in roles), + occupied_physical_families=len(family_masks), + families_with_multiple_children=sum(len(c) > 1 for c in family_children.values()), + maximum_helpers_of_one_call_on_one_family=max(call_families.values()), + idle_remainder_histogram={str(r): n * REPLICAS for r, n in + sorted(Counter(remainders.values()).items())}) + + +def d_apply(support, head, tail): + """Exact D_P on coordinate projectors: swap head/tail at support axes.""" + return (head & ~support) | (tail & support), (tail & ~support) | (head & support) + + +def counterexample(events, children, windows, slots, charts): + # Pair 1: child 0 is [1,15), child 7 is [36,64). Swap axes 8 and 36 + # ONLY in the latter child's realization. Each local bin keeps its + # rank, disjointness, window, offset and helper identity. + need(pending_axes(children[0]) == tuple(range(1, 15)) and + pending_axes(children[7]) == tuple(range(36, 64)) and + children[0]["pair"] == children[7]["pair"] == 1, "counterexample source children") + changed = dict(charts) + changed[7] = tuple(8 if a == 36 else a for a in charts[7]) + audit_slots(events, children, windows, slots, changed, strong=False) + original = modified = 0 + for child in children: + if child["pair"] == 1: + original ^= mask(charts[child["idx"]]) + modified ^= mask(changed[child["idx"]]) + need(original ^ modified == (1 << 8) | (1 << 36), "two-axis operator defect") + expected = d_apply(original, 1 << 8, 0) + actual = d_apply(modified, 1 << 8, 0) + need(expected == (0, 1 << 8) and actual == (1 << 8, 0), "exact coordinate witness") + return changed, dict(child=7, family_pair=1, axis_removed=36, axis_inserted=8, + overlapping_child=0, affected_axes=[8, 36], + input_head_axes=[8], input_tail_axes=[], + expected_head_axes=[], expected_tail_axes=[8], + actual_head_axes=[8], actual_tail_axes=[], + weak_count_window_check="accept", strong_geometric_check="reject") + + +def controls(events, children, windows, slots, charts, changed): + rejected = [] + + def reject(name, fn, expected): + try: + fn() + except Reject as error: + need(expected in str(error), name + " failed at unrelated check: " + str(error)) + rejected.append(name) + else: + raise Reject("accepted control: " + name) + + reject("equal_rank_cross_child_chart", lambda: check_children(children, changed), "cross-child") + swapped = dict(charts); swapped[1] = tuple(range(22, 29)) + reject("equal_rank_disjoint_wrong_child", lambda: check_children(children, swapped), "source pending") + repeated = dict(charts); repeated[0] = charts[0][:-1] + (charts[0][0],) + reject("duplicate_axis_within_chart", lambda: check_children(children, repeated), "axes distinct") + reject("omitted_helper", lambda: audit_slots(events, children, windows, slots[:-1], charts), "helper coverage") + reject("duplicate_helper", lambda: audit_slots(events, children, windows, slots + [slots[0]], charts), "duplicate helper") + first_multi = next(i for i, x in enumerate(slots) if x[2] == 8) + overlapping = list(slots) + x = list(overlapping[first_multi]); x[2] = 0; overlapping[first_multi] = tuple(x) + reject("distinct_helper_same_child_overlap", lambda: audit_slots(events, children, windows, overlapping, charts), + "within-child slot overlap") + outside = list(slots) + x = list(outside[0]); x[4] = next(s for s in range(STAGES) if s not in windows[x[0]][2]); outside[0] = tuple(x) + reject("call_outside_window", lambda: audit_slots(events, children, windows, outside, charts), "slot window") + bad_extent = list(slots) + x = list(bad_extent[0]); x[2] = -1; bad_extent[0] = tuple(x) + reject("negative_slot_offset", lambda: audit_slots(events, children, windows, bad_extent, charts), "slot extent") + bad_width = list(slots) + x = list(bad_width[0]); x[3] = 7; bad_width[0] = tuple(x) + reject("rank_seven_helper", lambda: audit_slots(events, children, windows, bad_width, charts), "slot extent") + bad_copy = list(slots) + x = list(bad_copy[0]); x[1] = 2 * V; bad_copy[0] = tuple(x) + reject("copy_outside_replica", lambda: audit_slots(events, children, windows, bad_copy, charts), "slot indices") + # Retain old windows: direct chronology must detect the new touch. + touched = deepcopy(events) + child, _, _, _, stage, _ = slots[0] + pos = next(i for i, e in enumerate(touched) if e.get("kind") == "local" and e["stage"] == stage) + pair = children[child]["pair"] + touched.insert(pos + 1, dict(kind="bridge", src=pair, dst=(pair + 1) % 4, coefficient=1)) + reject("intervening_touch_with_stale_windows", lambda: audit_slots(touched, children, windows, slots, charts), + "intervening bridge touch") + zero = dict(charts); zero[9] = (63,) + reject("nonempty_zero_rank_child", lambda: check_children(children, zero), "child rank") + return rejected + + +def verify(): + hashes = source_bindings() + events, children = controller() + charts = {c["idx"]: pending_axes(c) for c in children} + windows = backwards_windows(events, children) + need(windows == source_function(HOSTING, "windows")(events), "independent/source windows agree") + selection = read_json(BIT + "data/selection9-p111.json")["bit"] + slots, remaining = allocate(selection, windows) + ys = {(i, tuple(p)): n for i, p, n in selection["patterns"]} + zs = {(i, w, s): n for i, w, s, n in selection["stages"]} + # The emitter omits the zero-rank/no-window child. Retain it in our + # census as an explicit empty factor, but compare the exact emitted domain. + emitted_windows = {i: w for i, w in windows.items() if w[1] > 0 and w[2]} + reference, reference_remaining = source_function(HOSTING, "expand")( + emitted_windows, ys, zs, {s: [(h, 8) for h in range(R)] for s in range(STAGES)}, 2 * V) + need(slots == reference and {k: v for k, v in remaining.items() if k[0] in emitted_windows} + == reference_remaining, "independent/source expansion agree") + roles, actual_remaining = audit_slots(events, children, windows, slots, charts) + need(remaining == actual_remaining, "expanded/geometric remainders agree") + word = json.loads(gzip.decompress((ROOT / (BIT + "tune/bitE8mut-p111-tuned.json.gz")).read_bytes())) + local, dimensions = local_profile(word) + ports = port_projectors(word, roles, charts) + census = physical_census(children, roles, remaining) + complete = Counter({r: n * STAGES * REPLICAS for r, n in local.items()}) + complete.update({r: n * REPLICAS for r, n in Counter(remaining.values()).items() if r}) + expected = read_json(BIT + "tune/EXPECTED.json") + need(dict(complete) == {int(r): n for r, n in expected["nine"]["profile"].items()}, "full paid profile") + need(sum(r*n for r, n in complete.items()) == 1808352, "rank mass") + need(DIM * (8 * V * REPLICAS) - sum(r*n for r, n in complete.items()) == 10272, "deficit") + changed, witness = counterexample(events, children, windows, slots, charts) + faults = controls(events, children, windows, slots, charts, changed) + return dict(status="PASS_SELECTED_BIT_HOSTING_AUDIT", source_hashes=hashes, + result_kind="finite geometric audit with a weakened-implication counterexample", + idle_children=[dict(c, axes=list(charts[c["idx"]]), legal_stages=sorted(windows[c["idx"]][2])) + for c in children], + schedule_events=len(events), local_frames=len(dimensions), port_projectors=ports, + one_replica_slots=len(slots), slot_encoding="JSON ordered six-integer rows; compact separators", + one_replica_slots_sha256=digest(canonical(slots)), + local_profile={str(r): n for r, n in sorted(local.items())}, + full_profile={str(r): n for r, n in sorted(complete.items())}, + physical_census=census, counterexample=witness, rejected_controls=faults, + scope="No full native replay, arbitrary correlated-helper realization, all-size compiler, precision/tape, analytic transfer or new kappa.") + + +def main(): + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument("--write", type=Path, help="write a NEW result receipt exclusively") + args = parser.parse_args() + try: + result = verify() + if args.write: + with args.write.open("x") as stream: + json.dump(result, stream, indent=2, sort_keys=True) + stream.write("\n") + else: + expected = json.loads((PACKAGE / "RESULT.json").read_text()) + need(result == expected, "committed result receipt mismatch") + print(result["status"] + ": 126432 helper occurrences; 111 port projectors; " + + str(len(result["rejected_controls"])) + " controls rejected") + except (Reject, OSError, ValueError, KeyError, TypeError) as error: + raise SystemExit("REJECT_SELECTED_BIT_HOSTING_AUDIT: " + str(error)) from error + + +if __name__ == "__main__": + main()