From 48d36a6beaadd213da453568cbb4e934705f753e Mon Sep 17 00:00:00 2001 From: ToikY <27568617+ToikY@users.noreply.github.com> Date: Wed, 14 Oct 2026 04:34:11 -0700 Subject: [PATCH] Audit whole-call hosting projection of PR1817 retiming --- .../diagonal-retiming-host-boundary/README.md | 134 +++++++ .../RESULT.json | 326 ++++++++++++++++++ .../SOURCES.json | 58 ++++ .../diagonal-retiming-host-boundary/TASK.json | 136 ++++++++ .../VALIDATION.json | 98 ++++++ .../VERIFY.json | 32 ++ .../boundedgeometry.py | 229 ++++++++++++ .../predecessor/batch.py | 220 ++++++++++++ .../test_contract.py | 72 ++++ .../diagonal-retiming-host-boundary/verify.py | 288 ++++++++++++++++ 10 files changed, 1593 insertions(+) create mode 100644 research/diagonal-retiming-host-boundary/README.md create mode 100644 research/diagonal-retiming-host-boundary/RESULT.json create mode 100644 research/diagonal-retiming-host-boundary/SOURCES.json create mode 100644 research/diagonal-retiming-host-boundary/TASK.json create mode 100644 research/diagonal-retiming-host-boundary/VALIDATION.json create mode 100644 research/diagonal-retiming-host-boundary/VERIFY.json create mode 100644 research/diagonal-retiming-host-boundary/boundedgeometry.py create mode 100644 research/diagonal-retiming-host-boundary/predecessor/batch.py create mode 100644 research/diagonal-retiming-host-boundary/test_contract.py create mode 100644 research/diagonal-retiming-host-boundary/verify.py diff --git a/research/diagonal-retiming-host-boundary/README.md b/research/diagonal-retiming-host-boundary/README.md new file mode 100644 index 0000000000..af5fa5c62a --- /dev/null +++ b/research/diagonal-retiming-host-boundary/README.md @@ -0,0 +1,134 @@ +# PR1817 retiming preserves the selected whole-call hosting projection + +**Independent substitution-interface audit; no rank-16 child or new kappa.** +At [PR1817](https://github.com/CrocSwap/integer-mult-bounds/pull/1817) head +`ac3a759e874e8e526bc884fc2cb8eb114695b063`, the credited generator moves +original rank-one climbs inside their phases and identifies 134 potential +diagonal batches per orientation. The predecessor checks local replay but +explicitly leaves global owner/window and idle-frame sensitivity unverified. +This package closes that **coarse boundary projection** gap for its exact words. + +Every original child retains its rank and frame endpoints. The audit does not +replace any group with a rank-16 child. The actual local paid profile stays +`{1:2412,2:418,3:432,4:142,5:82,8:8}` and all added interface charges remain +outside this result. The original construction card's five-percent gate is not met. + +## Contract and proof + +The selected T16 controller completes each local invocation, its cover and +normalization wrappers before the next invocation. A whole helper occupies one +physical family for that complete invocation; its route and orthogonal chart +are fixed there. All 704 logical L owners in each call are distinct. Private +centre/tableau/coefficient roles retain their separate namespaces and their +inherited complete-child scratch contracts. Native implementation and tape +validity of those contracts remain assumptions of the selected construction. +In particular, each completed primitive must restore its shared implementation +workspace to the required caller state and have no dependence on its event +position. Disjoint logical supports alone do not prove physical commutation. + +Match every candidate event to one identical original occurrence. Within each +phase, the verifier compares the ordered occurrence list touching **each role**, +including reads, writes, scale/copy/ADD/CLEAR, frame climbs, centres, and all +adapters. It also fixes the non-rank-one skeleton and every phase marker. + +Why this proves local substitution: both words are linear extensions of the +same shared-role dependency order. To transform one into the other, move its +first desired occurrence left across the occurrences preceding it. Any such +crossed occurrence must have disjoint logical support, or its shared-role order +would differ. The two complete logical actions commute, so the swap preserves +the exact map on arbitrary inputs. Repeat inductively. Applying this argument +separately in each phase gives the same complete phase map, hence the same state +and frame boundary at every phase cut, including private cleanup. This assumes +the retained complete-primitive semantics; it is not a new native compiler proof. + +Why the hosting projection then stays unchanged: the actual selected window +reader measures eligibility between a replica's previous family touch and its +idle sweep, using **complete** local-cover events and bridges. It never uses a +position within the local word. The frozen source is +`research/complex-t16-rare-pattern-exchanges/upstream1087.tar.gz`, members +`code/audit_allcold.py` lines 124–156 and `t16/build_parent.py` lines 171–195. +The new independent geometry checker reconstructs those windows from the +selected outer schedule, rather than trusting their stored lists. + +Helper widths are the actual final-minus-start frame dimensions. Fixed widths, +owners, offsets and data axes determine the occupied pending coordinates and +the 73-axis spectator chart. The remaining idle frame is exactly the pending +axis suffix after the occupied prefix. None of these functions takes a +within-phase position as input. The checked unchanged local boundary and outer +schedule therefore yield identical whole-call reservations, charts and idle +frames. This also uses the inherited full-invocation residual-wrapper semantics. + +The result applies to this exact original-rank retiming with unchanged call +schedule and exclusive whole-call reservations. It gives no permission to +interleave calls, change an owner, move across a phase, or replace the native +operator alphabet. Global physical traces and precision envelopes were not replayed. + +## Exact evidence and binding limit + +[RESULT.json](RESULT.json) records both 24,767-event orientations, ten phase +cuts each and every shared-role occurrence trace. There are 7,111 permuted +positions in each orientation; batch counts reproduce 58 A, 52 B, four +cleanup-tail and 20 final groups. The batch construction and counts remain +PR1817's work; its unmodified generator is in `predecessor/batch.py` with exact +head, Git blob and SHA256 recorded in [SOURCES.json](SOURCES.json). + +The independent geometry replay checks all **144 calls**, **69,120 helper +reservations**, **288 exact windows**, **10,002 orthogonal 73-axis charts** and +**7,526 idle remainders**. It compares every exported idle axis and reconstructs +the unchanged global frame-child profile and deficit. The selected replay +archive is byte-pinned; consumed compressed members and decompressed payloads +are separately hashed. Nine semantic/geometric faults reject, including a private +namespace crossing into live owner storage. + +Both new event hashes differ from the selected ones, and **all 144 frozen call +bindings** name the old hashes. That is an explicit admission boundary: the +frozen native/phase/invoice receipts cannot be silently reused. This package is +a new finite projection receipt, not a new selected or full supplier admission. + +``` +python3.12 -B scripts/research_package.py --package research/diagonal-retiming-host-boundary +``` + +The normal command is read-only. `verify.py --write-result NEW_PATH` refuses an +occupied destination. Standard library only. [TASK.json](TASK.json) records the +changed scope, revision-3 selector nonce `48d7645b26b9f89e9337e038a86403f8`, base +`0b1cccf86e2f5132ed286a26ef0a681a495740ea` and the exact remaining obligations. +Source bindings and geometric equality are finite evidence; the substitution +argument above is a written proof, not a Lean or independent human review. + +## Open next questions + +- Can a **changed child or encoding contract** implement the proposed sixteen + independent climbs with all gathering, frame, scratch, output storage and + restoration charged? During this session Ross Richardson completed a + [source-bound audit](https://github.com/RossRichardson/integer-mult-bounds/tree/8a3900c84213fd7603b99beaceaff48f501b4232/research/diagonal-child-contract-audit) + applying Greer Guthrie's PR679 support/volume obstruction to the monomial + tensor-child proposal. A follow-up must name a changed hypothesis before + synthesis. That separate native-contract audit is credited, not replayed here. +- For an original-rank retimed provider, produce source-bound native/phase, + precision/tape and complete invoice/controller receipts for the two new + hashes, through fresh replay or an explicitly justified reuse path. The + audited boundary removes one uncertainty; old bindings cannot silently admit + new programs. No cold replay or selected-source update is supplied here. + +## Credit and overlap + +Josie Elliston and her disclosed Claude Code/Claude Opus 5.5 assistance supplied +PR1817's retiming recipe, 134-group lower bound and local-auditor replay. +PR1779 at `1e3128bf642bbaf250b7d6b9639b2bb24b98ce5e` supplied the diagonal +premise and original contiguous screen; its body credits Jose Manuel +(`jmbarrancoml`) and substantial Codex assistance, while the publishing account +is `1337isnot1337`. We retain those source notices without changing attribution. +Arham Tahir's PR1605 at `488f2ecf1835c6d813e96543656dddf0062fdc9a` supplies +the budget/overhead obstruction; Douglas Colkitt/PR1240 supplies the ceiling; +Sagar Thakrar/PR1012 supplies the coverage law. Whole-call hosting and asynchronous +controller credit includes the PR442/645/858 lineage, icekylinx, Jeremy Kothe, +Hao Yan, Rohan Arun/PR1094 and the selected review's retained contributors. + +Fresh PR bodies and relevant live Discussions were checked before claiming. +Scope is distinct from the completed native-child audit and the open exact phase-B +batch optimum. Search coverage is not a novelty certificate. New audit prepared +by @ToikY with substantial OpenAI Codex assistance, including bounded geometry +implementation, overlap review and independent static review. Apache-2.0; +predecessor source remains unchanged. Selected frontier and frozen packages +remain unchanged. diff --git a/research/diagonal-retiming-host-boundary/RESULT.json b/research/diagonal-retiming-host-boundary/RESULT.json new file mode 100644 index 0000000000..ce2bc96ccd --- /dev/null +++ b/research/diagonal-retiming-host-boundary/RESULT.json @@ -0,0 +1,326 @@ +{ + "archive_members": { + "candidate/strict/global/PLAN.json": { + "payload_sha256": "faebd4ce583996d6e7fb0729fce2738b3acaee9b4ff79962b95f60d6fe2cae24", + "source_sha256": "faebd4ce583996d6e7fb0729fce2738b3acaee9b4ff79962b95f60d6fe2cae24" + }, + "candidate/strict/global/base/providers/gauge44/CANONICAL-WORD.json.gz": { + "payload_sha256": "4ddb29fb9bc6f27e0c0fbfcf19a2a93a3496ad900d0f6d89059d0305c9576c0c", + "source_sha256": "16bc0ebb04b4be6c0ade74badc6a0c0cdba4215eda86e4ff9f13abf8ecebd219" + }, + "candidate/strict/global/base/providers/gauge44/LOCAL-CHECKS.json": { + "payload_sha256": "2b8b1891a736598010232bfb26abc31973b265a53a2009a3fcfd9138b5ecadb4", + "source_sha256": "2b8b1891a736598010232bfb26abc31973b265a53a2009a3fcfd9138b5ecadb4" + }, + "candidate/strict/global/base/providers/gauge44/LOCAL-PROGRAMS.json.gz": { + "payload_sha256": "9f41d53659e9be84e20c661560c5687abbf5cd0660cdecbe01ad5eb29e6b8ee3", + "source_sha256": "241fde27d4e43f5a9cb6b128f9f76c5131a53d09f0371676163f914d0b0fef3a" + }, + "candidate/strict/global/base/split-centres/GLOBAL-TEMPLATE.json.gz": { + "payload_sha256": "8904bbbf46dfbf1c6df0e43479a23913fc59a410e879188112e88f16c850ede8", + "source_sha256": "a179dad87651aba340a5a8ddbcd86a8e757cad87b8a1f8bad48106fbecd38518" + }, + "candidate/strict/global/base/work/complex-nine-native/DATA-PHASES.json": { + "payload_sha256": "c5916ff312678f12aba403847643fbbc29f643acec60bdf836fa56cd3e8251fa", + "source_sha256": "c5916ff312678f12aba403847643fbbc29f643acec60bdf836fa56cd3e8251fa" + }, + "candidate/strict/global/hosted/ACTUAL-SIGMAS.json.gz": { + "payload_sha256": "2cad2187e792fe7c879084a23f15577730ce27e82ff0c341885935c8adffc58f", + "source_sha256": "f12383eb2691fe33cc9f0525ccb5f6429db6d7bbf0eec76e97f50e752f943dd9" + }, + "candidate/strict/global/hosted/GLOBAL-TEMPLATE.json.gz": { + "payload_sha256": "9c4c51425251389ee9a747c465814cd07c64812c15b7aeef704dad7d65395a74", + "source_sha256": "2acf02b418078e37090495c601fe550448751d4f35912757b13a1f778efc7760" + }, + "candidate/strict/global/hosted/HOSTED.json": { + "payload_sha256": "1ea853d02e3d3377f03761909bf1825bde48431e9e2258303c57c78be12a4b95", + "source_sha256": "1ea853d02e3d3377f03761909bf1825bde48431e9e2258303c57c78be12a4b95" + }, + "candidate/strict/global/hosted/IDLE-REMAINDER-FRAMES.json.gz": { + "payload_sha256": "aa0df607a7f8f1804c3972703556000ebee5a5f4e3b3b76c27e570ed7ce17860", + "source_sha256": "650c14a1de75015fdae5c02ea18f1d0fd2de35d249b5ff2cd77f3b1afe604985" + } + }, + "batches": { + "backward": { + "A": 58, + "B": 52, + "cleanup_tail": 4, + "final": 20 + }, + "forward": { + "A": 58, + "B": 52, + "cleanup_tail": 4, + "final": 20 + } + }, + "conclusion": "The original-rank retimed streams preserve the audited whole-call hosting projection.", + "controls": [ + { + "control": "cross_own_scalar", + "rejected_by": "shared-role dependency order changed" + }, + { + "control": "cross_phase_boundary", + "rejected_by": "event omitted" + }, + { + "control": "omit_climb", + "rejected_by": "event omitted" + }, + { + "control": "unknown_operator", + "rejected_by": "non-rank-one skeleton changed" + }, + { + "control": "duplicate_owner", + "predicate": "distinct_704_owner_families", + "rejected": true + }, + { + "control": "excluded_call_time", + "predicate": "actual_source_touch_windows", + "rejected": true + }, + { + "control": "changed_pending_offset", + "predicate": "exact_idle_remainder_inventory", + "rejected": true + }, + { + "control": "changed_idle_axis", + "predicate": "literal_idle_pending_suffix_axes", + "rejected": true + }, + { + "control": "private_namespace_overlap", + "predicate": "private_namespace_disjoint_from_live_owners", + "rejected": true + } + ], + "input_sha256": { + "research/community-frontier1094-audit/selected-replay.tar.gz": "f1da80610bf33c58527f18ad63b4350d0b864e1d4486141ee17ac9bed4d529d6" + }, + "local_projections": { + "backward": { + "events": 24767, + "original_program_sha256": "f36c5831106f5637102c6bedeec76ed2b223c6671ce42fd0eceed9ef24725b23", + "permuted_positions": 7111, + "phases": [ + { + "events": 7400, + "phase": "zero_frame_precondition", + "phase_exit_frames_sha256": "bf49fb9bd01d22ae305cd0909e13409c6ffe0290fc1c2a35928e2c6162758f54", + "role_trace_sha256": "007d59cbdb88f3b1548efe27cc5ba31ab89ebaf0f515c3abc959d34298abc1d0", + "touched_roles": 352 + }, + { + "events": 704, + "phase": "entry_adapters", + "phase_exit_frames_sha256": "bf49fb9bd01d22ae305cd0909e13409c6ffe0290fc1c2a35928e2c6162758f54", + "role_trace_sha256": "d1627879e6ec2f08a310ef76e969a611484435bceb8475e4b4b47e5d176e6534", + "touched_roles": 704 + }, + { + "events": 4443, + "phase": "A", + "phase_exit_frames_sha256": "581da834649570243a7fc1223f664b34645ff6c0d5528fe7842bd9881bf7a2df", + "role_trace_sha256": "4c17c29333a569e33bd86d6a8559f309cb53584d4415b92395e4fd968926b56f", + "touched_roles": 441 + }, + { + "events": 208, + "phase": "centers", + "phase_exit_frames_sha256": "581da834649570243a7fc1223f664b34645ff6c0d5528fe7842bd9881bf7a2df", + "role_trace_sha256": "4688cd9bacdbd5fcc2c789f035b876e346c8f956fb9f43437a0053189c463f58", + "touched_roles": 104 + }, + { + "events": 3702, + "phase": "B", + "phase_exit_frames_sha256": "9c8f8f8ace916ec82f8b15c29f5f63d06e0586b928e062a05e8a278df50c93c0", + "role_trace_sha256": "58cafc22c9d16774099d5394ec2ab630c8b5c52fd895e6ae99ae94b35ba3a290", + "touched_roles": 592 + }, + { + "events": 240, + "phase": "cleanup_tail", + "phase_exit_frames_sha256": "e6a564ae128c5f83cc636f5579df088893f26a2339fccd3f4dad32885622bfb7", + "role_trace_sha256": "5026aca074e74849a4c7741cfc715147430ee74ce54aacbb132e1e95b3cec49b", + "touched_roles": 156 + }, + { + "events": 514, + "phase": "final", + "phase_exit_frames_sha256": "feef65df95af9ae193a9988edb5a7e9d3c607c8e4b7ffab3f3ef610dc184f1be", + "role_trace_sha256": "43bc6ff6d4c8a7f2ff0f886a3b73a86894a17c8036af6fcd72327352ff7099b3", + "touched_roles": 514 + }, + { + "events": 626, + "phase": "exit_adapters", + "phase_exit_frames_sha256": "feef65df95af9ae193a9988edb5a7e9d3c607c8e4b7ffab3f3ef610dc184f1be", + "role_trace_sha256": "24ba9310ff70231e6931314127be248071fc02742f733eed5197bee601a94307", + "touched_roles": 626 + }, + { + "events": 6920, + "phase": "full_frame_cleanup", + "phase_exit_frames_sha256": "feef65df95af9ae193a9988edb5a7e9d3c607c8e4b7ffab3f3ef610dc184f1be", + "role_trace_sha256": "7d4eb019cc926cd97f7fab5c9310b69b03bb20c857e9584aa74805fce30b8144", + "touched_roles": 592 + }, + { + "events": 0, + "phase": "done", + "phase_exit_frames_sha256": "feef65df95af9ae193a9988edb5a7e9d3c607c8e4b7ffab3f3ef610dc184f1be", + "role_trace_sha256": "4f53cda18c2baa0c0354bb5f9a3ecbe5ed12ab4d8e11ba873c2f11161202b945", + "touched_roles": 0 + } + ], + "retimed_program_sha256": "637b895b533c551542f6821d5ec23e6acb779c894a0b26097f40caf38388f61a", + "same_all_role_occurrence_traces": true, + "unchanged_literal_paid_profile": { + "1": 2412, + "2": 418, + "3": 432, + "4": 142, + "5": 82, + "8": 8 + }, + "whole_call_entry_sha256": "bf49fb9bd01d22ae305cd0909e13409c6ffe0290fc1c2a35928e2c6162758f54", + "whole_call_exit_sha256": "feef65df95af9ae193a9988edb5a7e9d3c607c8e4b7ffab3f3ef610dc184f1be" + }, + "forward": { + "events": 24767, + "original_program_sha256": "071ecdacc0bb3ac16046aad4119ed551a945cb0ed6c57002a548a3e2232503d8", + "permuted_positions": 7111, + "phases": [ + { + "events": 7400, + "phase": "zero_frame_precondition", + "phase_exit_frames_sha256": "bf49fb9bd01d22ae305cd0909e13409c6ffe0290fc1c2a35928e2c6162758f54", + "role_trace_sha256": "007d59cbdb88f3b1548efe27cc5ba31ab89ebaf0f515c3abc959d34298abc1d0", + "touched_roles": 352 + }, + { + "events": 704, + "phase": "entry_adapters", + "phase_exit_frames_sha256": "bf49fb9bd01d22ae305cd0909e13409c6ffe0290fc1c2a35928e2c6162758f54", + "role_trace_sha256": "d1627879e6ec2f08a310ef76e969a611484435bceb8475e4b4b47e5d176e6534", + "touched_roles": 704 + }, + { + "events": 4443, + "phase": "A", + "phase_exit_frames_sha256": "581da834649570243a7fc1223f664b34645ff6c0d5528fe7842bd9881bf7a2df", + "role_trace_sha256": "4c17c29333a569e33bd86d6a8559f309cb53584d4415b92395e4fd968926b56f", + "touched_roles": 441 + }, + { + "events": 208, + "phase": "centers", + "phase_exit_frames_sha256": "581da834649570243a7fc1223f664b34645ff6c0d5528fe7842bd9881bf7a2df", + "role_trace_sha256": "cc500d66263b554bdb293f491666ad002462e6b28377fe06877b2edb2b376118", + "touched_roles": 104 + }, + { + "events": 3702, + "phase": "B", + "phase_exit_frames_sha256": "9c8f8f8ace916ec82f8b15c29f5f63d06e0586b928e062a05e8a278df50c93c0", + "role_trace_sha256": "58cafc22c9d16774099d5394ec2ab630c8b5c52fd895e6ae99ae94b35ba3a290", + "touched_roles": 592 + }, + { + "events": 240, + "phase": "cleanup_tail", + "phase_exit_frames_sha256": "e6a564ae128c5f83cc636f5579df088893f26a2339fccd3f4dad32885622bfb7", + "role_trace_sha256": "5026aca074e74849a4c7741cfc715147430ee74ce54aacbb132e1e95b3cec49b", + "touched_roles": 156 + }, + { + "events": 514, + "phase": "final", + "phase_exit_frames_sha256": "feef65df95af9ae193a9988edb5a7e9d3c607c8e4b7ffab3f3ef610dc184f1be", + "role_trace_sha256": "43bc6ff6d4c8a7f2ff0f886a3b73a86894a17c8036af6fcd72327352ff7099b3", + "touched_roles": 514 + }, + { + "events": 626, + "phase": "exit_adapters", + "phase_exit_frames_sha256": "feef65df95af9ae193a9988edb5a7e9d3c607c8e4b7ffab3f3ef610dc184f1be", + "role_trace_sha256": "24ba9310ff70231e6931314127be248071fc02742f733eed5197bee601a94307", + "touched_roles": 626 + }, + { + "events": 6920, + "phase": "full_frame_cleanup", + "phase_exit_frames_sha256": "feef65df95af9ae193a9988edb5a7e9d3c607c8e4b7ffab3f3ef610dc184f1be", + "role_trace_sha256": "7d4eb019cc926cd97f7fab5c9310b69b03bb20c857e9584aa74805fce30b8144", + "touched_roles": 592 + }, + { + "events": 0, + "phase": "done", + "phase_exit_frames_sha256": "feef65df95af9ae193a9988edb5a7e9d3c607c8e4b7ffab3f3ef610dc184f1be", + "role_trace_sha256": "4f53cda18c2baa0c0354bb5f9a3ecbe5ed12ab4d8e11ba873c2f11161202b945", + "touched_roles": 0 + } + ], + "retimed_program_sha256": "396f77e3bb5ab9fd7e7961b0ad251e1874d7acab0ef851e4cbce7697c078d246", + "same_all_role_occurrence_traces": true, + "unchanged_literal_paid_profile": { + "1": 2412, + "2": 418, + "3": 432, + "4": 142, + "5": 82, + "8": 8 + }, + "whole_call_entry_sha256": "bf49fb9bd01d22ae305cd0909e13409c6ffe0290fc1c2a35928e2c6162758f54", + "whole_call_exit_sha256": "feef65df95af9ae193a9988edb5a7e9d3c607c8e4b7ffab3f3ef610dc184f1be" + } + }, + "new_kappa": false, + "predecessor_generator_sha256": "c9f0cbe4337e9c443ac2a10512111f60ab8d0459d2aae9de5176305d3a3bddc5", + "predecessor_head": "ac3a759e874e8e526bc884fc2cb8eb114695b063", + "rank16_child_constructed": false, + "retimed_programs_requiring_new_call_bindings": 144, + "status": "PASS_DIAGONAL_RETIMING_HOST_BOUNDARY", + "strict_admission": "New program hashes differ; frozen native/phase/invoice receipts cannot be reused as admission.", + "whole_call_geometry": { + "actual_73_axis_charts": 10002, + "complete_invocations": 144, + "geometry_sha256": "ec7fbae5a23dd58e39eb72afa927bd8915624c59ccee50bb344f2e0a550f69fd", + "global_frame_child_profile": { + "1": 349604, + "2": 60192, + "3": 62585, + "4": 20448, + "5": 11808, + "7": 7, + "8": 1152, + "48": 4866 + }, + "global_rank_mass": 1041408, + "helper_reservations": 69120, + "idle_rank_profile": { + "1": 2276, + "3": 377, + "7": 7, + "48": 4866 + }, + "idle_remainders": 7526, + "logical_roles_per_call": 704, + "pending_windows": 288, + "status": "PASS_WHOLE_INVOCATION_HOST_GEOMETRY", + "width_profile": { + "4": 56, + "5": 32, + "7": 30, + "8": 122, + "9": 240 + } + } +} diff --git a/research/diagonal-retiming-host-boundary/SOURCES.json b/research/diagonal-retiming-host-boundary/SOURCES.json new file mode 100644 index 0000000000..4c1967eda5 --- /dev/null +++ b/research/diagonal-retiming-host-boundary/SOURCES.json @@ -0,0 +1,58 @@ +{ + "schema_version": 1, + "base_commit": "0b1cccf86e2f5132ed286a26ef0a681a495740ea", + "files": [ + { + "path": "research/community-frontier1094-audit/selected-replay.tar.gz", + "usage": "input", + "git_blob": "c24daf067f9c543421d89ca2eeaa4eb78a57fb6f", + "sha256": "f1da80610bf33c58527f18ad63b4350d0b864e1d4486141ee17ac9bed4d529d6" + }, + { + "path": "research/complex-t16-rare-pattern-exchanges/upstream1087.tar.gz", + "usage": "provenance", + "git_blob": "2970ef79b0441e937449bed30f68f2e0558186ba", + "sha256": "d4acf04daef85d4514f80ec5fcd2492d0c60e5d6c49fa71b3e6523f8db2dea86" + }, + { + "path": "certificates/selected-result.json", + "usage": "provenance", + "git_blob": "ae6a99f28aa468649eb66a361e764d769363bf11", + "sha256": "10b9e340fd8e354a37a0c4813c90e5de1dd42044b5f6aca4a3fc5a42b685fa32" + }, + { + "path": "docs/research/agent-task-catalog.json", + "usage": "provenance", + "git_blob": "06c96f5579bb67ed1b86d334e78fbed7da6945f1", + "sha256": "6686ad58f1fbdbc87134a78901b60fd53a20d3984355e91defbbebc9e9fa8075" + }, + { + "path": "docs/research/community-batch1099-review.md", + "usage": "provenance", + "git_blob": "6cb6ec061a071a06a2d18cd4dc3e9a2b05d28099", + "sha256": "7e76d2c38e5fce30587835b7251df1430488ae4dd372611ef69a3f03f476b6cb" + }, + { + "path": "research/community-frontier1094-audit/SELECTED-SOURCE.json", + "usage": "provenance", + "git_blob": "6a75493790b4eff9c4a98051ef8b01d6aad0d5a8", + "sha256": "79b3de5db3dbcb9829789ba58e9e45758926031e2a7d80667a08429d369be53b" + }, + { + "path": "research/community-frontier1094-audit/ASSEMBLY.json", + "usage": "provenance", + "git_blob": "5fd676df060f3b450782fdf5ff5f6beb63a5eeb0", + "sha256": "1122cb3a575f8c788345fc1bf4c108ac7c3250fb81a5988671f5eb04b3ab3045" + } + ], + "vendored_predecessor": { + "path": "predecessor/batch.py", + "repository": "CrocSwap/integer-mult-bounds", + "source_path": "research/diagonal-batch-commutation/batch.py", + "head": "ac3a759e874e8e526bc884fc2cb8eb114695b063", + "git_blob": "e8c7c25d1a200aabdcb707fb800e579c93046dd8", + "sha256": "c9f0cbe4337e9c443ac2a10512111f60ab8d0459d2aae9de5176305d3a3bddc5", + "license": "Apache-2.0", + "attribution": "Josie Elliston, with substantial Claude (Anthropic) assistance; unchanged bytes" + } +} diff --git a/research/diagonal-retiming-host-boundary/TASK.json b/research/diagonal-retiming-host-boundary/TASK.json new file mode 100644 index 0000000000..d4790f14ad --- /dev/null +++ b/research/diagonal-retiming-host-boundary/TASK.json @@ -0,0 +1,136 @@ +{ + "schema_version": 1, + "task_id": "complex-rank-shape-decoder", + "priority_revision": 3, + "base_commit": "0b1cccf86e2f5132ed286a26ef0a681a495740ea", + "original_card": { + "id": "complex-rank-shape-decoder", + "question": "Can a decoder deliver the local paid mass in fewer, larger-rank children (block frame climbs instead of rank-1 to rank-3 steps)?", + "starting_points": [ + "research/complex-local-word-ceiling/README.md", + "research/complex-decoder-field-extension-seed44/README.md", + "research/complex-frame-pair-decoders/README.md" + ], + "methods": [ + "Find one exact small decoding identity whose frame path climbs in blocks, and price its complete per-call profile.", + "Bound the best effective child rank achievable for one fixed support alphabet, including copies, frames and restoration." + ], + "acceptance_gate": "A per-call local profile, with all copied information, frames and restoration counted, whose ceiling exceeds the selected word's by at least 5%; masked or overcomplete supports must change an assumption of the eight-term all-pairs bound.", + "first_step": { + "command": [ + "python3", + "-B", + "research/complex-local-word-ceiling/verify.py" + ], + "expected": "PASS_COMPLEX_LOCAL_WORD_CEILING", + "inspect": "Read the selected word's per-call local profile, its packing ceiling and the lever table; run levers.py for the ideal budget of the lever you target.", + "scope": "Positive control and planning budget only; this is not a new construction or full cold replay." + }, + "first_experiment": "Before any synthesis, write the candidate per-call local profile (and centre charge / unpaid coordinates if changed) and screen it with ceiling.ceiling(); reject it if even the ideal ceiling does not beat the selected word's by your stated margin. Ideal budget: rank-16 delivery is 2.31x (levers.py).", + "bottleneck_link": "Rank-1 children are about half of recursive cost; the selected word's effective child rank is about 3.9. Larger-rank delivery lowers recursive cost per unit of paid mass.", + "allowed_variations": [ + "One masked, overcomplete or block decoder family with exact labels and supports.", + "A scoped lower bound on effective rank for one alphabet.", + "If the coverage law, template or guard changes, derive an applicable fully charged replacement bound instead of applying the incumbent ceiling outside its scope." + ], + "scope_change_triggers": [ + "Repacking idle remainders of an unchanged word (covered by the packing ceiling).", + "Repeating the eight-term all-pairs search inside its proved scope." + ], + "overlap_terms": [ + "rank shape", + "block climb", + "masked decoder", + "overcomplete", + "effective rank" + ] + }, + "scope_status": "changed", + "actual_scope": "Independently audit whether PR1817 within-phase retiming of original rank-one climbs preserves the selected whole-call owner, busy-window and idle-remainder frame contract on its pinned selected provider and owner geometry.", + "scope_change_reason": "The assigned card asks for a larger-rank physical construction and complete profile. This session instead addresses one explicitly unresolved admission implication in PR1817: unchanged local replay does not by itself establish unchanged global hosting. Original rank-one children are retained; no actual diagonal rank-sixteen replacement is admitted and the original five-percent construction gate is not claimed met.", + "bottleneck_link": "PR1817 supplies 134 register-commuted diagonal-batch candidates and a favorable pricing relaxation. Their eligibility depends on whether retimed original events preserve the selected global owner/window boundaries. Closing or falsifying that implication prevents a local chronology certificate from being mistaken for complete hosting admission; the diagonal-child implementation remains separate.", + "budget_minutes": 60, + "stop_rule": "Session 2026-10-14 10:56:17..11:56:17 UTC. Stop constructing at 11:41:17 UTC and reserve the final quarter for verification and concise handoff. Audit only the pinned PR1817 original-rank-one retiming and selected coarse owner/window/frame boundary; no exact batch optimum, physical diagonal child synthesis, global search or frontier change.", + "outcome": "completed", + "evidence": "RESULT.json: both24767-event original-rank orientations preserve all10phase cuts andeveryshared-role occurrence trace;144whole-call owner projections,69120helperreservations,288strictbusywindows,10002orthogonal73-axis charts and7526idleaxis suffixes independently replay. Nine semantic/geometric faults reject. Literal globalframeprofile hasmass1041408 anddeficit5120; all144retimedprogramhash bindings require replacement. Actualrank16children, native/phase/precision/invoice receipts and fullsupplier admission are not supplied.", + "author": "@ToikY, with substantial OpenAI Codex assistance", + "ai_assistance": "Substantial OpenAI Codex assistance in overlap review, source inspection, invariant derivation, implementation, independent bounded pipeline tracing, tests, validation and writing. No independent human review is claimed.", + "selection_nonce": "48d7645b26b9f89e9337e038a86403f8", + "scope_key": "02b31ebd160542c86299/PR1817/whole-call-owner-window-invariance", + "selection": { + "track": "complex-mechanisms", + "priority_revision": 3, + "seed": "48d7645b26b9f89e9337e038a86403f8", + "assigned_method": "Find one exact small decoding identity whose frame path climbs in blocks, and price its complete per-call profile.", + "audit_method": "Independently trace the retimed rank-one event word through the selected coarse owner/window/frame interface." + }, + "method": "Bind PR1817 exact retimed streams and their selected source ancestry. Preserve each phase and each register dependency projection; compare all proof-relevant coarse geometry fields and the actual whole-call owner/idle-remainder conditions. Distinguish source/geometry preservation from strict input-manifest rebinding and native precision/controller admission.", + "domain": { + "provider": "Pinned selected PR1094 gauge44 provider used by PR1817, in both emitted local orientations.", + "allowed_retiming": "Only original rank-one climbs moved within their original phase past events not touching their register, under PR1817 exact stated dependency rule. All retained scalar, center, wrapper and other-rank semantics remain inherited.", + "children": "Every original rank-one child remains present, with its original frame endpoints and rank. No batch is replaced by a rank-sixteen child.", + "target_obligation": "The same selected whole-call owners, busy windows and idle-remainder frame contract, with exact source identities and proof-relevant fields retained.", + "excluded": "Physical diagonal-child input/output gathering, copies, output storage, new native recipes, rank-sixteen profiles, gathering/restoration charges, precision improvements, new owner search and complete supplier or multiplication admission." + }, + "nearest_overlap": [ + { + "pr": 1817, + "head": "ac3a759e874e8e526bc884fc2cb8eb114695b063", + "contributor": "Prepared for Josie Elliston with Claude Code (Claude Opus 5.5), as disclosed in the pinned PR body.", + "delta": "The predecessor proves local retiming replay and greedy batch counts but explicitly leaves global hosting/idle-remainder frame sensitivity to within-phase positions unchecked. This audit addresses only that remaining implication." + }, + { + "pr": 1779, + "head": "1e3128bf642bbaf250b7d6b9639b2bb24b98ce5e", + "contributor": "The pinned diagonal-batch screen contributor and its source notices; original algebraic premise credited.", + "delta": "Contiguous diagonal batching and its zero-interface-cost pricing are context; neither physical diagonal-child construction nor a new contiguous count is claimed here." + }, + { + "pr": 1605, + "head": "488f2ecf1835c6d813e96543656dddf0062fdc9a", + "contributor": "Arham Tahir, rank-one reblocking budgets and per-block overhead obstruction.", + "delta": "Its on-top charge model remains pricing context. This package proves no new overhead threshold or effective-rank construction." + } + ], + "overlap_check": { + "open_prs_fetched_at": "2026-10-14T10:57:30Z", + "open_pr_bodies": 481, + "complete_pagination": true, + "finding": "Targeted fresh PR-body and local README/TASK/ledger searches found no exact phase-B solver, on-top 134-batch specialization or global-hosting retiming audit. PR1817 is the nearest scoped predecessor. This is bounded coverage, not a priority guarantee.", + "discussion_scope": "Root checked Discussion1596: PR1817 claim is done/released, no hosting-retiming claim found. Ross Richardson has an active diagonal native-child contract claim until 2026-10-14 12:55 UTC; that work is explicitly excluded.", + "active_excluded_claim": "https://github.com/CrocSwap/integer-mult-bounds/discussions/1596#discussioncomment-18922195", + "limits": "Open PR bodies and local metadata do not exhaust nested diffs or all literature. Discussion checks are recorded separately by root." + }, + "cost_effect": "Original child ranks, rank mass, local paid profile and selected frontier are retained. No new ceiling, five-percent physical construction, on-top headroom, native child interface or kappa is claimed.", + "open_questions": [ + { + "question": "Can a rank-sixteen diagonal child realize a certified batch at its distinct frames with a complete favorable cost?", + "why_it_matters": "Admission of the original retimed rank-one word would not establish an actual larger-rank replacement or its gathering, copy, restoration and hosting bill.", + "first_step": "Name the PR679 monomial-adapter/volume-cost hypothesis that changes, then specify two actual independent dirty payload recipes and the complete gather/encode/child/decode/restoration invoice. Read the completed Ross Richardson source-bound application before repeating its excluded model.", + "blocked_by": "The physical diagonal native-child contract is outside this audit and independently claimed until 2026-10-14 12:55 UTC." + }, + { + "question": "What strict source rebinding and full precision/controller evidence are needed to adopt a retimed provider?", + "why_it_matters": "A preserved coarse owner/frame invariant is distinct from unchanged immutable event hashes and complete supplier admission.", + "first_step": "Generate the retimed artifacts from their pinned source, bind every changed digest and strict manifest, and replay the actual primitive prefixes, controller charts/routes, wrapper/restoration and complete invoice.", + "blocked_by": "No new strict source manifest, full native precision/controller replay, physical batch adoption, all-size compiler, tape or analytic-transfer theorem is supplied by the coarse-boundary audit." + } + ], + "predecessor_credit": [ + "Josie Elliston and disclosed Claude Code assistance, PR1817 register-commutation retiming and local certificate", + "PR1779 diagonal-batch premise and source-bound contiguous screen, original author/source notices retained", + "Arham Tahir, PR1605 budgets and per-block overhead", + "Douglas Colkitt, PR1240 packing ceiling and research protocol", + "Sagar Thakrar, PR1012 coverage law", + "Jeremy Kothe, Rohan Arun, Hao Yan and the selected PR1094 construction/packing/controller lineage", + "icekylinx, retained local checker and scalar/phase/compiler lineage", + "DreamingOfClouds, Chafik Boukhalfa, eumemic and all retained helper/realization/analytic contributors" + ], + "claim_url": "https://github.com/CrocSwap/integer-mult-bounds/discussions/1596#discussioncomment-18922356", + "parallel_finding": { + "author": "Ross Richardson", + "head": "8a3900c84213fd7603b99beaceaff48f501b4232", + "url": "https://github.com/RossRichardson/integer-mult-bounds/tree/8a3900c84213fd7603b99beaceaff48f501b4232/research/diagonal-child-contract-audit", + "delta": "Completed during this session: source-bound application of Greer Guthrie PR679 support/volume obstruction to the proposed native child. Read and credited, not replayed here. Our original-rank whole-call projection remains distinct." + } +} diff --git a/research/diagonal-retiming-host-boundary/VALIDATION.json b/research/diagonal-retiming-host-boundary/VALIDATION.json new file mode 100644 index 0000000000..4b3e11269d --- /dev/null +++ b/research/diagonal-retiming-host-boundary/VALIDATION.json @@ -0,0 +1,98 @@ +{ + "schema_version": 1, + "base_commit": "0b1cccf86e2f5132ed286a26ef0a681a495740ea", + "python": "3.12.14", + "platform": "macOS arm64", + "registered_replay": { + "argv": [ + "python3.12", + "-B", + "scripts/research_package.py", + "--package", + "research/diagonal-retiming-host-boundary" + ], + "exit_code": 0, + "wall_seconds": 7.593160124961287, + "checks": [ + "both exact orientations", + "nine semantic/geometric controls", + "three independent operator-oracle tests" + ] + }, + "operator_oracle": { + "event_permutations": 720, + "dirty_F5_states_per_accepted_order": 625, + "test_groups": 3, + "exit_code": 0 + }, + "export_and_rejection_controls": [ + { + "name": "EXPORT-NORMAL", + "exit_code": 0, + "expected_success": true, + "wall_seconds": 7.4039585827849805 + }, + { + "name": "EXPORT-OPTIMIZED", + "exit_code": 0, + "expected_success": true, + "wall_seconds": 7.351415624842048 + }, + { + "name": "CORRUPT-RECEIPT", + "exit_code": 1, + "expected_success": false, + "wall_seconds": 7.381938250269741 + }, + { + "name": "CORRUPT-INPUT", + "exit_code": 1, + "expected_success": false, + "wall_seconds": 0.09915062505751848 + }, + { + "name": "CORRUPT-PREDECESSOR", + "exit_code": 1, + "expected_success": false, + "wall_seconds": 0.08737554075196385 + }, + { + "name": "OCCUPIED-OUTPUT", + "exit_code": 1, + "expected_success": false, + "file_preserved": true + } + ], + "no_git_export": true, + "verify_sha256": "1f66bfd8d3c7d6ebbffd580558112447af42597321fe081899b2b3b1eeac3e8e", + "result_sha256": "86f29a9c569f3d17d0f3fde3f280df870857eb8127a88e7f98b08c1965ef0915", + "overlap": { + "entry_open_pr_records": 481, + "final_open_pr_records": 489, + "final_fetched_at": "2026-10-14T11:28:40Z", + "local_records": 873, + "discussion_read_scope": [ + "1163 start and latest claims", + "1166 newest handoffs", + "active board", + "1596 full relevant thread" + ], + "limits": [ + "Numbered REST PR pages are not atomic.", + "No complete Discussion pagination/cache.", + "Leads only; not a novelty certificate." + ], + "nearest_pr": 1817, + "nearest_head": "ac3a759e874e8e526bc884fc2cb8eb114695b063" + }, + "independent_review": "A separate bounded Codex static review checked the written trace implication, actual whole-call source consumers and the final namespace/global profile additions; no actionable finding remains. No human review.", + "initial_failure": "First generic replay rejected only numeric histogram-key canonical ordering; compute now normalizes its JSON result before strict comparison. Original failed logs retained, final replay passes.", + "not_run": [ + "Actual rank16 child construction", + "Native/phase/precision/controller invoice regeneration", + "Full frontier1094-verify", + "Lean", + "Parallel Ross/PR679 native-contract replay" + ], + "no_new_kappa": true +} diff --git a/research/diagonal-retiming-host-boundary/VERIFY.json b/research/diagonal-retiming-host-boundary/VERIFY.json new file mode 100644 index 0000000000..4e94561089 --- /dev/null +++ b/research/diagonal-retiming-host-boundary/VERIFY.json @@ -0,0 +1,32 @@ +{ + "schema_version": 1, + "status": "ready", + "python": "3.12", + "requirements": [], + "inputs": [ + "research/community-frontier1094-audit/selected-replay.tar.gz" + ], + "commands": [ + { + "argv": [ + "{python}", + "-I", + "-B", + "{package}/verify.py" + ], + "timeout_seconds": 180, + "checks": "Bind PR1817 retiming; compare every phase and shared-role occurrence trace; independently replay all144 complete-call owner/window/chart/idle projections; reject semantic and geometric faults; demonstrate all144 frozen program bindings need replacement." + }, + { + "argv": [ + "{python}", + "-I", + "-B", + "{package}/test_contract.py", + "-v" + ], + "timeout_seconds": 60, + "checks": "An independent F5 scalar interpreter checks every accepted shared-role ordering among all720 permutations of six mixed operations on all625 dirty inputs; duplicate occurrence and unknown original-event controls reject." + } + ] +} diff --git a/research/diagonal-retiming-host-boundary/boundedgeometry.py b/research/diagonal-retiming-host-boundary/boundedgeometry.py new file mode 100644 index 0000000000..6c46bfdeaa --- /dev/null +++ b/research/diagonal-retiming-host-boundary/boundedgeometry.py @@ -0,0 +1,229 @@ +"""Independent whole-invocation geometry audit of the selected PR1094 export. + +No local compiler, emitter, owner optimizer, or predecessor executable is imported. +The input is parsed archive members, not paths. This checks the boundary consumed +by hosting; it does not admit a new child operator, native recipe, or invoice. +Prepared by @ToikY with substantial OpenAI Codex assistance. Apache-2.0. +""" + +import copy +import hashlib +import json +from collections import Counter, defaultdict + +BASE = "candidate/strict/global/" +TEMPLATE = BASE + "hosted/GLOBAL-TEMPLATE.json.gz" +PLAN = BASE + "PLAN.json" +PARENT = BASE + "base/split-centres/GLOBAL-TEMPLATE.json.gz" +PHASES = BASE + "base/work/complex-nine-native/DATA-PHASES.json" +SIGMAS = BASE + "hosted/ACTUAL-SIGMAS.json.gz" +IDLE_FRAMES = BASE + "hosted/IDLE-REMAINDER-FRAMES.json.gz" +CANONICAL = BASE + "base/providers/gauge44/CANONICAL-WORD.json.gz" +REQUIRED_MEMBERS = (TEMPLATE, PLAN, PARENT, PHASES, SIGMAS, IDLE_FRAMES, CANONICAL) + + +class GeometryError(ValueError): + """A named finite geometry predicate failed.""" + + +def require(condition, predicate): + if not condition: + raise GeometryError(predicate) + + +def digest(value): + return hashlib.sha256(json.dumps(value, sort_keys=True, separators=(",", ":")).encode()).hexdigest() + + +def boundary(word): + """Actual ordered endpoint vectors, independent of frame identifier names.""" + return { + **{k: word[k] for k in ("v", "h", "R", "ports", "centers")}, + "start": [word["frames"][i] for i in word["start"]], + "final": [word["frames"][i] for i in word["final"]], + "center_frames": [word["frames"][i] for i in word["center_frames"]], + } + + +def audit_geometry(members, word): + """Return counts/signature after checking every selected owner reservation.""" + require(set(REQUIRED_MEMBERS) <= set(members), "required_archive_members") + template, plan, parent, phases, stored_sigmas, idle_frames, source = ( + members[p] for p in REQUIRED_MEMBERS + ) + require((word["v"], word["h"], word["R"]) == (112, 9, 480), "local_dimensions") + require(len(word["start"]) == len(word["final"]) == 704, "local_role_count") + require(boundary(word) == boundary(source), "unchanged_actual_local_boundary") + require((template["m"], template["live"]) == (73, 14336), "global_dimensions") + require(template["physical"] == 14826 and template["private_namespace"] == { + "centers": [14336, 14344], "reserved_tableau": [14344, 14824], + "coefficient": [14824, 14826]}, "private_namespace_disjoint_from_live_owners") + require(phases["m"] == 73 and len(phases["recipes"]) == 112, "data_phase_dimensions") + require(template["recipe"] == parent["recipe"], "unchanged_outer_recipe") + require("no within-cover or within-invocation interleaving" in template["async_schedule"]["scope"], "indivisible_invocation_contract") + require(template["hosting"]["max_helpers_per_physical_family_per_call"] == 1, "whole_helper_contract") + require(template["hosting"]["banks"] == [0] * 9, "unchanged_bankless_hosting") + widths = [len(word["frames"][word["final"][224+h]]) - len(word["frames"][word["start"][224+h]]) for h in range(480)] + require(all(0 < w <= 9 for w in widths), "positive_residual_widths") + registry = template["local_providers"] + require(set(registry) == {"gauge44"} and registry["gauge44"]["widths"] == widths, "provider_width_boundary") + require(registry["gauge44"]["ports"] == word["ports"], "provider_ports") + require(plan["provider_registry"]["gauge44"]["widths"] == widths and plan["provider_registry"]["gauge44"]["ports"] == word["ports"], "plan_provider_geometry") + order = [[c["stage"], c["replica"]] for c in template["calls"]] + require(len(order) == 144 and len({tuple(c) for c in order}) == 144, "complete_call_order") + require(set(map(tuple, order)) == {(s, r) for s in range(9) for r in range(16)}, "complete_call_domain") + require(order == plan["order"] == template["async_schedule"]["order"], "bound_call_order") + require(template["async_schedule"]["source_schedule"] == parent["execution_schedule"], "source_schedule_binding") + require(template["async_schedule"]["source_call_order"] == [[c["stage"], c["replica"]] for c in parent["calls"]], "source_call_order_binding") + require(all("replica" in e for e in template["execution_schedule"][:-2]) and [e["source_event"] for e in template["execution_schedule"][-2:]] == [30, 31], "final_global_tail_positions") + stage_pair = {e["stage"]: e["pair"] for e in parent["recipe"] if e["kind"] == "local"} + ranks = {e["child"]: e["rank"] for e in parent["idle_children"]} + require(len(ranks) == 18, "pending_child_inventory") + pair_side, intervals, last, callpos = {}, {}, {}, {} + per_replica = defaultdict(list) + global_events = [] + block = -1 + for pos, event in enumerate(template["execution_schedule"]): + j = event["source_event"] + require(0 <= j < len(parent["execution_schedule"]), "source_event_index") + expected = dict(parent["execution_schedule"][j], source_event=j) + if "replica" not in event: + global_events.append(j) + if event["kind"] == "bank_padding_cover_sweep": + expected["families"] = [14336, 14336] + if event["kind"] == "translate_every_live_family": + expected.update(families=[0, 14336], charged_calls_per_cover=14336) + require(event == expected, "global_event_projection") + continue + r = event["replica"] + require(0 <= r < 16 and j < 30, "replica_event_domain") + per_replica[r].append(j) + expected.update(replica=r, replicas=[r], time=event["time"]) + if event["kind"] == "local_cover_sweep": + block += 1 + expected["provider_id"] = "gauge44" + require(order[block] == [event["stage"], r], "schedule_call_order") + callpos[block] = pos + last[r, stage_pair[event["stage"]]] = pos + require(event["time"] == block, "indivisible_schedule_block") + require(event == expected, "replica_event_projection") + if event["kind"] == "bridge": + last[r, event["src"]] = last[r, event["dst"]] = pos + if event["kind"] == "idle_cover_sweep": + for side, child in enumerate(event["child_indices"]): + if child not in ranks: # The inherited schedule also names zero-rank children. + continue + pair_side[child] = (event["pair"], side) + intervals[r, child] = (last.get((r, event["pair"]), -1), pos) + require(global_events == [30, 31] and set(per_replica) == set(range(16)), "global_tail_and_replicas") + require(all(v == list(range(30)) for v in per_replica.values()), "per_replica_source_order") + require(set(callpos) == set(range(144)), "scheduled_complete_calls") + windows = {f"{r},{i}": [ranks[i], [t for t, p in sorted(callpos.items()) if a < p < b]] for (r, i), (a, b) in intervals.items()} + require(windows == plan["windows"], "actual_source_touch_windows") + bases = [] + for port, q in enumerate(word["ports"]): + require(0 < q < 512 and q.bit_count() % 2 == 1, "odd_port_vector") + z = next((i for i in range(9) if not (q >> i) & 1), None) + require(z is not None, "port_missing_coordinate") + a = q ^ (1 << z) + positions = list(range(9)) + positions[0], positions[z] = positions[z], positions[0] + basis = [(1 << i) ^ (a if (a >> i) & 1 else 0) for i in positions] + [1 << i for i in range(9, 73)] + require(all((x & y).bit_count() % 2 == int(i == j) for i, x in enumerate(basis) for j, y in enumerate(basis)), "orthogonal_73_axis_basis") + bases.append(basis) + for i, e in enumerate(phases["recipes"][port]["idle_children"]): + require(e["rank"] == len(e["orthogonal_axes"]) == ranks.get(i, 0), "pending_axis_rank") + require(len(set(e["orthogonal_axes"])) == e["rank"] and set(e["orthogonal_axes"]) <= set(basis), "pending_axes_in_port_basis") + used, roles, actual_sigmas = defaultdict(set), {}, {} + parent_calls = {(c["stage"], c["replica"]): c for c in parent["calls"]} + for time, call in enumerate(template["calls"]): + s, r = call["stage"], call["replica"] + require(call["time"] == time and call["provider_id"] == "gauge44", "call_time_and_provider") + old = parent_calls[s, r] + require(all(call[k] == old[k] for k in ("stage", "replica", "pair", "orientation", "window")), "data_call_boundary") + own = call["owners"] + require(len(own) == 704 and len({f for f, _ in own}) == 704, "distinct_704_owner_families") + require(all(0 <= f < 14336 for f, _ in own), "live_owner_domain") + require(own[:224] == old["owners"][:224], "unchanged_data_owner_routes") + for h, (family, route) in enumerate(own[224:]): + width = widths[h] + require(len(route) >= 3, "helper_route_shape") + _, child, offset = route[:3] + owner_replica, sub = divmod(family, 896) + pair, sub = divmod(sub, 224) + side, port = divmod(sub, 112) + require(child in ranks and (pair, side) == pair_side[child], "helper_owner_child_family") + require(time in windows[f"{owner_replica},{child}"][1], "helper_strict_busy_window") + require(0 <= offset and offset + width <= ranks[child], "helper_pending_capacity") + pending = phases["recipes"][port]["idle_children"][child]["orthogonal_axes"] + occupied = [bases[port].index(x) for x in pending[offset:offset+width]] + spectators = [i for i in range(73) if i not in occupied][:9-width] + expected_route = [3, child, offset] if width == 9 else [4, child, offset, width, spectators] + require(route == expected_route, "literal_helper_spectator_route") + permutation = occupied + spectators + [i for i in range(73) if i not in occupied and i not in spectators] + require(sorted(permutation) == list(range(73)), "helper_chart_axis_permutation") + sigma = [bases[port][i] for i in permutation] + # All charts are permutations of an independently checked orthobasis. + actual_sigmas[digest(sigma)] = sigma + key = (owner_replica, child, port) + cells = set(range(offset, offset+width)) + require(not used[key] & cells, "disjoint_pending_reservations") + used[key].update(cells) + roles[s, r, h] = dict(stage=s, replica=r, helper=h, family=family, owner_replica=owner_replica, child=child, copy=owner_replica*112+port, port=port, offset=offset, width=width) + require(actual_sigmas == stored_sigmas, "all_literal_73_axis_charts") + pooled = template["hosting"]["pooled_slots"] + require(len(pooled) == len(roles) == 69120, "complete_helper_reservations") + seen = set() + for slot in pooled: + key = slot["stage"], slot["replica"], slot["helper"] + require(key in roles and key not in seen, "unique_pooled_role") + require({k: slot[k] for k in roles[key]} == roles[key], "literal_pooled_role_binding") + require(slot["time"] == order.index([key[0], key[1]]), "pooled_role_time") + seen.add(key) + wanted = [] + for old in parent["idle_children"]: + child, port = old["child"], old["port"] + for r in range(16): + cells = used[r, child, port] + require(cells == set(range(len(cells))), "compacted_pending_prefix") + remaining = old["rank"] - len(cells) + require(remaining >= 0, "nonnegative_idle_remainder") + if remaining: + pair, side = pair_side[child] + wanted.append(dict(child=child, port=port, replica=r, replicas=1, family=896*r+(2*pair+side)*112+port, rank=remaining, hosted=len(cells), pending_offset=len(cells))) + require(template["idle_children"] == wanted, "exact_idle_remainder_inventory") + exported = [dict(e, orthogonal_axes=phases["recipes"][e["port"]]["idle_children"][e["child"]]["orthogonal_axes"][e["pending_offset"]:]) for e in wanted] + require(all(len(e["orthogonal_axes"]) == e["rank"] for e in exported), "idle_suffix_rank") + require(exported == idle_frames, "literal_idle_pending_suffix_axes") + projection = dict(local_boundary=boundary(word), order=order, windows=windows, calls=[{k: c[k] for k in ("stage", "replica", "pair", "orientation", "window", "owners")} for c in template["calls"]], charts=actual_sigmas, idle_frames=exported) + return dict(status="PASS_WHOLE_INVOCATION_HOST_GEOMETRY", complete_invocations=144, logical_roles_per_call=704, helper_reservations=69120, actual_73_axis_charts=len(actual_sigmas), pending_windows=len(windows), idle_remainders=len(wanted), width_profile=dict(sorted(Counter(widths).items())), idle_rank_profile=dict(sorted(Counter(e["rank"] for e in wanted).items())), geometry_sha256=digest(projection)) + + +def run_geometry_controls(members, word): + """Five independently mutated geometric exports must fail named checks.""" + controls = {} + mutations = ("duplicate_owner", "excluded_call_time", "changed_pending_offset", "changed_idle_axis", + "private_namespace_overlap") + for name in mutations: + changed = dict(members) + path = PLAN if name == "excluded_call_time" else IDLE_FRAMES if name == "changed_idle_axis" else TEMPLATE + changed[path] = copy.deepcopy(members[path]) + if name == "duplicate_owner": + changed[path]["calls"][0]["owners"][224][0] = changed[path]["calls"][0]["owners"][0][0] + elif name == "excluded_call_time": + call = members[TEMPLATE]["calls"][0] + family, route = call["owners"][224] + changed[path]["windows"][f"{family//896},{route[1]}"][1].remove(0) + elif name == "changed_pending_offset": + changed[path]["idle_children"][0]["pending_offset"] += 1 + elif name == "changed_idle_axis": + changed[path][0]["orthogonal_axes"][0] ^= 1 + else: + changed[path]["private_namespace"]["centers"][0] = 14335 + try: + audit_geometry(changed, word) + except GeometryError as error: + controls[name] = dict(rejected=True, predicate=str(error)) + else: + raise GeometryError("control_not_rejected:" + name) + return controls diff --git a/research/diagonal-retiming-host-boundary/predecessor/batch.py b/research/diagonal-retiming-host-boundary/predecessor/batch.py new file mode 100644 index 0000000000..e8c7c25d1a --- /dev/null +++ b/research/diagonal-retiming-host-boundary/predecessor/batch.py @@ -0,0 +1,220 @@ +#!/usr/bin/env python3 +"""Dependency-respecting diagonal batching of rank-1 climbs in the selected gauge44 provider. + +A rank-1 climb on register L r reads and writes only L r. It may therefore be moved past any event +that touches no L r, inside its own phase. This script moves rank-1 climbs (only those; every other +event keeps its relative order), groups them into disjoint batches of 16 on distinct destinations +by an earliest-deadline greedy, emits the reordered programs, and replays their frame semantics. + +usage: batch.py LOCAL-PROGRAMS.json.gz CANONICAL-WORD.json.gz +Prepared for Josie Elliston with Claude (Anthropic) assistance. Apache-2.0. +""" +from __future__ import annotations + +import collections +import gzip +import json +import sys + +BATCH = 16 + + +def touched(event): + """Registers ('L', r) or ('C', k) that an event reads or writes.""" + tag = event[0] + if tag == 'climb': + return {('L', event[2])} + if tag in ('adapter', 'residual_adapter'): + return {('L', event[2])} + if tag == 'center': + return {('C', event[1])} + if tag == 'scalar': + e = event[1] + regs = {tuple(e[1])} + if e[0] in ('copy', 'add'): + regs.add(tuple(e[2])) + return regs + return set() + + +def is_r1(event): + return event[0] == 'climb' and event[5] == 1 + + +def split_phases(events): + """[(phase_event_or_None, [events...])] in order.""" + out = [(None, [])] + for e in events: + if e[0] == 'phase': + out.append((e, [])) + else: + out[-1][1].append(e) + return out + + +def batch_phase(body): + """Return (new_body, batches) for one phase body.""" + skel = [e for e in body if not is_r1(e)] + s = len(skel) + # original skeleton gap of each rank-1 climb and its legal window [lo, hi] + climbs = [] # (orig_order, gap, event) + gap = 0 + for e in body: + if is_r1(e): + climbs.append((len(climbs), gap, e)) + else: + gap += 1 + touch_pos = collections.defaultdict(list) + for i, e in enumerate(skel): + for reg in touched(e): + touch_pos[reg].append(i) + import bisect + win = {} + for k, g, e in climbs: + pos = touch_pos[('L', e[2])] + j = bisect.bisect_left(pos, g) # skeleton events at index < g lie before the climb + lo = pos[j - 1] + 1 if j > 0 else 0 + hi = pos[j] if j < len(pos) else s + win[k] = (lo, hi) + # same-register climbs sharing a window must keep their order: exclude them from batching + by_win = collections.Counter((e[2], win[k]) for k, g, e in climbs) + movable = [k for k, g, e in climbs if by_win[(e[2], win[k])] == 1] + ev = {k: e for k, g, e in climbs} + orig_gap = {k: g for k, g, e in climbs} + # earliest-deadline greedy sweep over gaps + start_at = collections.defaultdict(list) + for k in movable: + start_at[win[k][0]].append(k) + avail = set() + batches = collections.defaultdict(list) # gap -> list of batches + batched = set() + for g in range(s + 1): + avail.update(start_at[g]) + while any(win[k][1] == g for k in avail) and len(avail) >= BATCH: + pick = sorted(avail, key=lambda k: (win[k][1], k))[:BATCH] + batches[g].append(pick) + batched.update(pick) + avail.difference_update(pick) + avail = {k for k in avail if win[k][1] > g} + # emit: at each gap, batches first, then unbatched climbs that originally sat there + stay = collections.defaultdict(list) + for k, g, e in climbs: + if k not in batched: + stay[g].append(k) + out = [] + for g in range(s + 1): + for b in batches[g]: + out.extend(ev[k] for k in b) + out.extend(ev[k] for k in stay[g]) + if g < s: + out.append(skel[g]) + flat = [b for g in sorted(batches) for b in batches[g]] + for b in flat: + assert len({ev[k][2] for k in b}) == BATCH + return out, [[ev[k] for k in b] for b in flat], len(climbs), len(movable) + + +def replay_frames(events, word): + """Frame-semantics replay (the subset of hpe_audit_local's checks that reordering can affect).""" + frames = word['frames'] + + def contains(a, b): + for x in a: + for y in b: + if x >> (y.bit_length() - 1) & 1: + x ^= y + if x: + return False + return True + + cur = list(word['start']) + phase = None + private = {} + for e in events: + tag = e[0] + if tag == 'phase': + phase = e[1] + assert not private + elif tag == 'climb': + _, part, r, a, b, rank = e + assert not private and phase == part and cur[r] == a + assert contains(frames[a], frames[b]) and rank == len(frames[b]) - len(frames[a]) > 0 + cur[r] = b + elif tag == 'scalar': + _, op, f = e + target = tuple(op[1]) + source = tuple(op[2]) if op[0] in ('copy', 'add') else None + if target[0] == 'C' and op[0] == 'clear': + private.pop(target, None) + continue + for reg in (target, source): + if reg is None: + continue + if reg[0] == 'L': + assert cur[reg[1]] == f, ('common frame', reg, cur[reg[1]], f) + else: + if reg == target and reg not in private: + private[reg] = f + assert private[reg] == f + elif tag == 'center': + assert phase == 'centers' + private[('C', e[1])] = e[3] + assert cur == word['final'], 'terminal frames' + + +def rank_one_runs_1779(events): + """PR1779's contiguous-run batch rule, re-implemented: phases skipped, any other event breaks a run.""" + runs, current = [], [] + for e in events: + if e[0] == 'phase': + continue + if is_r1(e): + current.append(e) + else: + if current: + runs.append(current) + current = [] + if current: + runs.append(current) + n = 0 + for run in runs: + for g in range(len(run) // BATCH): + block = run[g * BATCH:(g + 1) * BATCH] + if len({e[2] for e in block}) == BATCH: + n += 1 + return n + + +def main(prog_path, word_path, out_path=None): + programs = json.load(gzip.open(prog_path)) + reordered = {} + word = json.load(gzip.open(word_path)) + result = {} + for orient, events in programs.items(): + replay_frames(events, word) # positive control: original program + new_events, per_phase = [], [] + nb = 0 + for ph, body in split_phases(events): + if ph is not None: + new_events.append(ph) + nb_body, batches, n1, nmov = batch_phase(body) + new_events.extend(nb_body) + if n1: + per_phase.append((ph[1] if ph else None, n1, nmov, len(batches))) + nb += len(batches) + assert collections.Counter(json.dumps(e) for e in new_events) == collections.Counter(json.dumps(e) for e in events) + assert [e for e in new_events if not is_r1(e)] == [e for e in events if not is_r1(e)] + replay_frames(new_events, word) + reordered[orient] = new_events + result[orient] = dict(batches=nb, per_phase=per_phase, + pr1779_rule_original=rank_one_runs_1779(events), + pr1779_rule_reordered=rank_one_runs_1779(new_events)) + if out_path: + with gzip.open(out_path, 'wt') as fh: + json.dump(reordered, fh, separators=(',', ':')) + print(json.dumps(result, indent=1)) + return result + + +if __name__ == '__main__': + main(*sys.argv[1:4]) diff --git a/research/diagonal-retiming-host-boundary/test_contract.py b/research/diagonal-retiming-host-boundary/test_contract.py new file mode 100644 index 0000000000..d822e953ab --- /dev/null +++ b/research/diagonal-retiming-host-boundary/test_contract.py @@ -0,0 +1,72 @@ +"""Small independent operator oracle for the shared-role trace implication. + +Prepared by @ToikY with substantial OpenAI Codex assistance. Apache-2.0. +""" +import importlib.util +import itertools +from pathlib import Path +import unittest + +spec = importlib.util.spec_from_file_location('trace_checker', Path(__file__).with_name('verify.py')) +checker = importlib.util.module_from_spec(spec) +spec.loader.exec_module(checker) + + +def execute(events, inputs): + values = list(inputs) + for event in events: + op = event[1] + tag, target = op[0], op[1][1] + if tag == 'clear': + values[target] = 0 + elif tag == 'scale': + values[target] = op[2]*values[target] % 5 + elif tag == 'copy': + values[target] = values[op[2][1]] + elif tag == 'add': + values[target] = (values[target]+op[3]*values[op[2][1]]) % 5 + else: + raise ValueError('oracle unknown operation') + return tuple(values) + + +class TraceContractTests(unittest.TestCase): + def test_all_six_event_permutations_on_all_dirty_f5_inputs(self): + original = [ + ['scalar', ['scale', ['L', 0], 2], 0], + ['scalar', ['add', ['L', 1], ['L', 0], 1], 0], + ['scalar', ['clear', ['L', 2]], 0], + ['scalar', ['add', ['L', 3], ['L', 2], 1], 0], + ['scalar', ['scale', ['L', 2], 3], 0], + ['scalar', ['copy', ['L', 0], ['L', 3]], 0], + ] + inputs = list(itertools.product(range(5), repeat=4)) + expected = [execute(original, state) for state in inputs] + accepted = rejected = 0 + for order in itertools.permutations(range(6)): + candidate = [original[i] for i in order] + try: + checker.occurrence_projection(original, candidate) + except ValueError: + rejected += 1 + continue + accepted += 1 + self.assertEqual([execute(candidate, state) for state in inputs], expected) + self.assertGreater(accepted, 1) + self.assertGreater(rejected, 1) + self.assertEqual(accepted+rejected, 720) + + def test_occurrence_inventory_cannot_hide_a_duplicate(self): + one = ['scalar', ['scale', ['L', 0], 2], 0] + two = ['scalar', ['scale', ['L', 1], 3], 0] + with self.assertRaisesRegex(ValueError, 'inventory'): + checker.occurrence_projection([one, two], [one, one]) + + def test_unknown_original_event_fails_closed(self): + unknown = ['unlisted_workspace_writer', 0] + with self.assertRaisesRegex(ValueError, 'unknown local event'): + checker.occurrence_projection([unknown], [unknown]) + + +if __name__ == '__main__': + unittest.main() diff --git a/research/diagonal-retiming-host-boundary/verify.py b/research/diagonal-retiming-host-boundary/verify.py new file mode 100644 index 0000000000..da96da02b8 --- /dev/null +++ b/research/diagonal-retiming-host-boundary/verify.py @@ -0,0 +1,288 @@ +#!/usr/bin/env python3 +"""Source-bound whole-call hosting projection for PR1817's unmerged retiming. + +Prepared by @ToikY with substantial OpenAI Codex assistance. Apache-2.0. +The unchanged predecessor batch generator is credited in README.md. +""" +import argparse +from collections import Counter, defaultdict, deque +import copy +import gzip +import hashlib +import importlib.util +import json +from pathlib import Path +import tarfile + +HERE = Path(__file__).resolve().parent +ROOT = HERE.parents[1] +ARCHIVE = 'research/community-frontier1094-audit/selected-replay.tar.gz' +PREFIX = 'candidate/strict/global/' +BATCH_SHA = 'c9f0cbe4337e9c443ac2a10512111f60ab8d0459d2aae9de5176305d3a3bddc5' +MEMBERS = [ + PREFIX + 'PLAN.json', + PREFIX + 'hosted/GLOBAL-TEMPLATE.json.gz', + PREFIX + 'hosted/HOSTED.json', + PREFIX + 'hosted/ACTUAL-SIGMAS.json.gz', + PREFIX + 'hosted/IDLE-REMAINDER-FRAMES.json.gz', + PREFIX + 'base/split-centres/GLOBAL-TEMPLATE.json.gz', + PREFIX + 'base/work/complex-nine-native/DATA-PHASES.json', + PREFIX + 'base/providers/gauge44/CANONICAL-WORD.json.gz', + PREFIX + 'base/providers/gauge44/LOCAL-PROGRAMS.json.gz', + PREFIX + 'base/providers/gauge44/LOCAL-CHECKS.json', +] + + +def need(condition, message): + if not condition: + raise ValueError(message) + + +def encoded(value): + return json.dumps(value, sort_keys=True, separators=(',', ':')).encode() + + +def digest(value): + return hashlib.sha256(encoded(value)).hexdigest() + + +def input_pins(): + inventory = json.loads((HERE / 'SOURCES.json').read_text(encoding='utf-8')) + result = {} + for row in inventory['files']: + if row['usage'] != 'input': + continue + path = (ROOT / row['path']).resolve() + need(path.is_relative_to(ROOT) and path.is_file() and not path.is_symlink(), 'input path') + sha = hashlib.sha256(path.read_bytes()).hexdigest() + need(sha == row['sha256'], 'source drift: ' + row['path']) + result[row['path']] = sha + need(ARCHIVE in result, 'undeclared selected archive') + need(hashlib.sha256((HERE / 'predecessor/batch.py').read_bytes()).hexdigest() == BATCH_SHA, + 'vendored PR1817 generator drift') + return result + + +def load_members(): + members, hashes = {}, {} + with tarfile.open(ROOT / ARCHIVE, 'r:gz') as archive: + for name in MEMBERS: + stream = archive.extractfile(name) + need(stream is not None, 'missing archive member: ' + name) + raw = stream.read() + payload = gzip.decompress(raw) if name.endswith('.gz') else raw + hashes[name] = {'source_sha256': hashlib.sha256(raw).hexdigest(), + 'payload_sha256': hashlib.sha256(payload).hexdigest()} + members[name] = json.loads(payload) + return members, hashes + + +def touched(event): + tag = event[0] + if tag == 'climb': + return {('L', event[2])} + if tag in ('adapter', 'residual_adapter'): + return {('L', event[2])} + if tag == 'center': + return {('C', event[1])} + if tag == 'scalar': + op = event[1] + need(op[0] in ('copy', 'add', 'clear', 'scale'), 'unknown scalar') + roles = {tuple(op[1])} + if op[0] in ('copy', 'add'): + roles.add(tuple(op[2])) + return roles + raise ValueError('unknown local event: ' + tag) + + +def phases(events): + blocks = [] + for event in events: + if event[0] == 'phase': + blocks.append((event[1], [])) + else: + need(bool(blocks), 'event before phase') + blocks[-1][1].append(event) + need(len({name for name, _ in blocks}) == len(blocks), 'duplicate phase') + return blocks + + +def is_rank_one(event): + return event[0] == 'climb' and event[5] == 1 + + +def occurrence_projection(original, candidate): + """Match identical occurrences, then preserve every shared-role dependency.""" + queues = defaultdict(deque) + for index, event in enumerate(original): + queues[encoded(event)].append(index) + mapped = [] + for event in candidate: + queue = queues[encoded(event)] + need(bool(queue), 'event inventory changed') + mapped.append(queue.popleft()) + need(not any(queues.values()), 'event omitted') + old, new = defaultdict(list), defaultdict(list) + for index, event in enumerate(original): + for role in touched(event): + old[role].append(index) + for index in mapped: + for role in touched(original[index]): + new[role].append(index) + need(dict(old) == dict(new), 'shared-role dependency order changed') + return mapped, old + + +def audit_local(original, candidate, word): + old_blocks, new_blocks = phases(original), phases(candidate) + need([n for n, _ in old_blocks] == [n for n, _ in new_blocks], 'phase boundary changed') + old_frames, new_frames = list(word['start']), list(word['start']) + rows, moved = [], 0 + for (name, old), (_, new) in zip(old_blocks, new_blocks): + need([e for e in old if not is_rank_one(e)] == [e for e in new if not is_rank_one(e)], + 'non-rank-one skeleton changed') + mapping, traces = occurrence_projection(old, new) + moved += sum(i != j for i, j in enumerate(mapping)) + for body, frames in ((old, old_frames), (new, new_frames)): + for event in body: + if event[0] == 'climb': + _, part, role, before, after, rank = event + need(part == name and frames[role] == before, 'climb frame or phase') + need(rank == len(word['frames'][after]) - len(word['frames'][before]) > 0, + 'climb rank changed') + frames[role] = after + need(old_frames == new_frames, 'phase-cut frames changed') + rows.append({'phase': name, 'events': len(old), 'touched_roles': len(traces), + 'role_trace_sha256': digest([[list(r), seq] for r, seq in sorted(traces.items())]), + 'phase_exit_frames_sha256': digest(old_frames)}) + need(old_frames == new_frames == word['final'], 'whole-call endpoint frames') + return {'events': len(original), 'phases': rows, 'permuted_positions': moved, + 'original_program_sha256': digest(original), 'retimed_program_sha256': digest(candidate), + 'same_all_role_occurrence_traces': True, + 'whole_call_entry_sha256': digest(word['start']), + 'whole_call_exit_sha256': digest(word['final'])} + + +def local_controls(programs, retimed, word): + def rejected(label, bad): + try: + audit_local(programs['forward'], bad, word) + except ValueError as error: + return {'control': label, 'rejected_by': str(error)} + raise ValueError('control accepted: ' + label) + original = retimed['forward'] + bad = copy.deepcopy(original) + for index in range(1, len(bad)): + if is_rank_one(bad[index]) and bad[index-1][0] == 'scalar' and ( + 'L', bad[index][2]) in touched(bad[index-1]): + bad[index-1], bad[index] = bad[index], bad[index-1] + break + else: + raise ValueError('no shared-role control site') + controls = [rejected('cross_own_scalar', bad)] + bad = copy.deepcopy(original) + marker = bad.index(['phase', 'centers']) + index = max(i for i in range(marker) if is_rank_one(bad[i])) + event = bad.pop(index) + bad.insert(bad.index(['phase', 'centers'])+1, event) + controls.append(rejected('cross_phase_boundary', bad)) + bad = copy.deepcopy(original) + bad.pop(next(i for i, event in enumerate(bad) if is_rank_one(event))) + controls.append(rejected('omit_climb', bad)) + bad = copy.deepcopy(original) + index = next(i for i, event in enumerate(bad) if event[0] == 'adapter') + bad[index][0] = 'unrecognized_shared_scratch_operation' + controls.append(rejected('unknown_operator', bad)) + return controls + + +def compute(): + pins = input_pins() + members, hashes = load_members() + word = members[PREFIX + 'base/providers/gauge44/CANONICAL-WORD.json.gz'] + programs = members[PREFIX + 'base/providers/gauge44/LOCAL-PROGRAMS.json.gz'] + checks = members[PREFIX + 'base/providers/gauge44/LOCAL-CHECKS.json'] + need((word['v'], word['h'], word['R'], len(word['start']), len(word['final'])) == + (112, 9, 480, 704, 704), 'selected geometry') + spec = importlib.util.spec_from_file_location('credited_batch', HERE / 'predecessor/batch.py') + batch = importlib.util.module_from_spec(spec) + spec.loader.exec_module(batch) + retimed, local, batches = {}, {}, {} + for orientation in ('forward', 'backward'): + events, counts = [], {} + for name, body in phases(programs[orientation]): + new, groups, _, _ = batch.batch_phase(body) + for group in groups: + need(len(group) == 16 and len({e[2] for e in group}) == 16 + and all(is_rank_one(e) for e in group), 'distinct-register batch certificate') + events.append(['phase', name]) + events.extend(new) + if groups: + counts[name] = len(groups) + need(sum(counts.values()) == 134, 'predecessor batch count') + retimed[orientation], batches[orientation] = events, counts + local[orientation] = audit_local(programs[orientation], events, word) + profile = dict(sorted(Counter(e[-1] for e in events if e[0] in ('climb', 'center')).items())) + need(profile == {int(k): v for k, v in word['local_profile'].items()} == + {int(k): v for k, v in checks[orientation]['paid_profile'].items()}, + 'literal original-rank paid profile') + local[orientation]['unchanged_literal_paid_profile'] = profile + # LOCAL-CHECKS uses the exact emitter's compact event encoding. + need(local[orientation]['original_program_sha256'] == checks[orientation]['sha256'], + 'selected program publication binding') + geom_spec = importlib.util.spec_from_file_location('boundary_geometry', HERE / 'boundedgeometry.py') + geometry = importlib.util.module_from_spec(geom_spec) + geom_spec.loader.exec_module(geometry) + geometric = geometry.audit_geometry(members, word) + calls = members[PREFIX + 'hosted/GLOBAL-TEMPLATE.json.gz']['calls'] + stale_calls = 0 + for call in calls: + orientation = call['orientation'] + need(call['local_program_sha256'] == local[orientation]['original_program_sha256'], + 'selected complete-call program binding') + stale_calls += call['local_program_sha256'] != local[orientation]['retimed_program_sha256'] + need(stale_calls == 144, 'retiming did not exercise program rebinding boundary') + paid = Counter({int(r): n*len(calls) for r, n in + local['forward']['unchanged_literal_paid_profile'].items()}) + paid.update({int(r): n for r, n in geometric['idle_rank_profile'].items()}) + plan = members[PREFIX + 'PLAN.json'] + need(dict(paid) == {int(r): n for r, n in plan['profile'].items()}, + 'unchanged global frame-child profile') + geometric['global_frame_child_profile'] = dict(sorted(paid.items())) + geometric['global_rank_mass'] = sum(r*n for r, n in paid.items()) + need(73*14336-geometric['global_rank_mass'] == plan['deficit'], 'global deficit') + controls = local_controls(programs, retimed, word) + controls.extend({'control': name, **row} for name, row in + geometry.run_geometry_controls(members, word).items()) + need(input_pins() == pins, 'sources changed during replay') + result = {'status': 'PASS_DIAGONAL_RETIMING_HOST_BOUNDARY', 'input_sha256': pins, + 'archive_members': hashes, 'predecessor_head': 'ac3a759e874e8e526bc884fc2cb8eb114695b063', + 'predecessor_generator_sha256': BATCH_SHA, 'batches': batches, + 'local_projections': local, 'whole_call_geometry': geometric, 'controls': controls, + 'retimed_programs_requiring_new_call_bindings': stale_calls, + 'conclusion': 'The original-rank retimed streams preserve the audited whole-call hosting projection.', + 'strict_admission': 'New program hashes differ; frozen native/phase/invoice receipts cannot be reused as admission.', + 'rank16_child_constructed': False, 'new_kappa': False} + # JSON histogram keys are strings; normalize before strict canonical comparison. + return json.loads(json.dumps(result)) + + +def main(): + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument('--write-result', type=Path) + args = parser.parse_args() + if args.write_result: + need(not args.write_result.exists(), 'output already exists') + result = compute() + if args.write_result: + with args.write_result.open('x', encoding='utf-8') as stream: + json.dump(result, stream, indent=2, sort_keys=True) + stream.write('\n') + else: + expected = json.loads((HERE / 'RESULT.json').read_text(encoding='utf-8')) + need(encoded(result) == encoded(expected), 'receipt mismatch') + print('PASS_DIAGONAL_RETIMING_HOST_BOUNDARY orientations=2 batches=134 calls=144 no_rank16_admission no_new_kappa') + + +if __name__ == '__main__': + main()