diff --git a/research/selected-centre-bridge-projection/README.md b/research/selected-centre-bridge-projection/README.md new file mode 100644 index 0000000000..8b6f33abb1 --- /dev/null +++ b/research/selected-centre-bridge-projection/README.md @@ -0,0 +1,192 @@ +# Independent adjoint audit of bridge-aware centre sources + +**Independent finite audit; no new supplier or kappa.** Two separately written +algorithms reproduce the selected controller's **1,152-dimensional source-history +rank**, already reported in [PR2622](https://github.com/CrocSwap/integer-mult-bounds/pull/2622). +The new verification uses a backward local adjoint and dense controller matrices +to check every source coefficient against a forward rational calculation. + +A concrete failure control explains the need for that coefficient check: +reversing **every bridge sign** retains rank **1,152** and the identity endpoint +on **14,336 owners**, yet changes **930 source rows**. One unit-input cut changes +from **+1 to -1**. Endpoint identity plus full source rank does not identify the +correct intermediate source map. This is a checker control, not a defect report +against PR2622, which authenticates its inputs and also audits the output response. + +The scope is the common-frame scalar projection. Native owner/address routing +remains open; idle sweeps are explicitly identity here. This does not independently +verify PR2622's distinct final error-response map or claim priority for its rank. + +## Exact boundary and result + +The inputs are the selected PR1094 replay archive, bound by the selected assembly, +from main `c3c94c2ea2ebcd5d69d1e51b5fe8a36bf79819f5`. The archive contains the +actual **480-helper**, 704-role local word. No 492-helper ancestor is substituted. +[SOURCES.json](SOURCES.json) pins every external input. The selected conditional +kappa remains `836330098538459/500000000000000000`. + +As in Adam Gall's PR1918 and thakrarsagar's PR2199, each physical owner starts +with an independent formal scalar over Q. Local `clear`, `copy`, `scale` and +`add` operations retain their exact coefficients. A `center` event records the +private C register at its rank-eight child. Local climbs, adapters, residual +adapters and the centre child itself act as identity in this declared projection. +The checker derives both local endpoint maps from **every scalar event** on all +704 formal columns and checks private clearing: + +- forward: `Y_p += X_p` for all 112 ports; +- backward: `X_p -= Y_p` for all 112 ports; +- all other ordinary roles are restored. + +The audit executes each bridge in the actual asynchronous event order. For +an event with destination pair d, source pair s and coefficient c, it applies + +```text +X_d,p += c X_s,p +Y_s,p -= c Y_d,p +``` + +for every port p. The signed terminal is `(X,Y) <- (Y,-X)` simultaneously on +each pair. These formulas come from the pinned inherited complex geometry +proof, section “Four-pair scalar chain and idle children”. The complete +per-replica recipe and data-owner indexing are checked against the selected +template. In particular, +`owner(replica,pair,side,port) = 896*replica + 112*(2*pair+side) + port` is checked +against all local data-role maps, rather than assumed for arbitrary helper roles. + +| Quantity | Calls-only predecessor projection | Projection with bridges and terminal | +|---|---:|---:| +| Local cover calls / centre rows | 144 / 1,152 | 144 / 1,152 | +| Rational rank of all centre rows | 1,152 | 1,152 | +| Changed centre rows relative to predecessor | — | 930 | +| Identity endpoint owners | 0 | 14,336 | + +The calls-only comparison reproduces PR2199's call table, local cut support +sizes, complete centre-row support histogram and rational rank. It is a control, +not a defect claim against a predecessor that explicitly omitted these events. + +A small exact witness shows that the added bridges matter. Set initial physical +owner **224** (replica 0, pair 1, X side, port 0) to one and every other initial +owner to zero. At call **time 10 / stage 2 / replica 0 / centre 0**, the calls-only +cut is zero and the bridge-aware cut is one. This witness is derived from the +complete symbolic rows, not from a sampled floating-point calculation. + +Because all 1,152 rows are linearly independent, every subset is independent; +in particular, every two distinct calls supply 16 independent formal cut rows +in this model. This is **not** a 16-scalar output-transcript lower bound: that +would additionally need the fixed-dirt output-increment map, its consumer and +panel boundary. Full cut rank cannot replace those obligations. + +## Two implementations and controls + +`verify.py` propagates exact sparse rational forms forward through each local +program, composes them with a 14,336-owner state, and performs rational row +elimination. It checks the complete projected endpoint and emits [RESULT.json](RESULT.json). + +`check_adjoint.py` imports neither that checker nor supplier code. It pulls each +cut backwards through the local scalar operations, then reconstructs the +chronological owner state using 16 dense integer 8-by-8 controller matrices. +Every coefficient of all 1,152 rows agrees with the first implementation through +the canonical row digest. Rows follow chronological call order, then centre +index 0 through 7. Each row is its ascending-column list of `[index, str(Fraction)]` +pairs; the digest is SHA-256 of compact JSON with separators `(',', ':')`. +A separate reverse-row, largest-column +elimination gives rank 1,152 modulo `2147483647`. All denominators are invertible +modulo that prime, so a nonzero maximal minor is also nonzero over Q; the row +count supplies the upper bound. The primary result does not rely on this modular +check: it also computes rank directly over Q. + +Controls include all 18 individually omitted half-bridges, all bridges removed, +all bridge signs reversed, and dependent duplicate rows. Each individual +half-bridge omission breaks the 8-by-8 endpoint. Removing all bridges changes +both cuts and endpoint. Reversing **all** bridge signs changes the cuts but +**preserves** the endpoint: it conjugates the controller by the alternating-pair +sign matrix `diag(1,1,-1,-1,1,1,-1,-1)`. Every selected bridge joins opposite pair +parities, whereas each local call and terminal acts within one pair. Thus the +sign matrix negates all bridge shears and commutes with those other operations; +conjugation preserves the full controller's identity endpoint. + +Both algorithms separately check that this wrong-sign controller also retains +rank 1,152, but changes 930 rows. For the owner-224 input above, its first changed +cut is -1 instead of +1. The receipt binds its full row digest and exact witness. +This finite counterexample establishes that **endpoint identity and source rank +together are insufficient** to certify the intermediate centre coefficients. + +The checks remain active under Python `-O`. Both checkers authenticate inputs +before computing; normal primary execution compares every receipt field. + +## Reproduce + +Python 3.11 or later, standard library only, from the repository root: + +```sh +python3 -I -B research/selected-centre-bridge-projection/verify.py +python3 -I -O -B research/selected-centre-bridge-projection/check_adjoint.py +python3.12 scripts/research_package.py --package research/selected-centre-bridge-projection +``` + +Expected markers: + +```text +PASS_SELECTED_CENTRE_BRIDGE_PROJECTION rank=1152 changed_rows=930 endpoint_owners=14336 +PASS_SELECTED_CENTRE_BRIDGE_ADJOINT rows=1152 rank_mod_2147483647=1152 controls=3 +``` + +`verify.py --write` regenerates the receipt. The registered runner uses Python +3.12 and bounds each command by the replay manifest. Local +interpreter versions and actual runs are recorded in TASK.json. A local pass is +not a claim that upstream CI ran. + +## Cost, limits and expansion decision + +The unchanged 144 calls retain 1,152 rank-eight centre children, total rank mass +9,216, or 64 per call. There is no eliminated work and no changed cost profile. +No sharing construction is proposed. This result narrows a verification gap; +it does not pass the task card's construction or 10-percent improvement gate. + +The 160 idle sweeps, 16 terminal Y translations, one bank-padding sweep and one +final every-family translation are explicitly assigned identity in this model. +Likewise, the exact complex phases and native address charts are not modeled. +This formal projection is **not proved to be a representation or specialization +of the native supplier**. Its rank need not be a native rank lower bound. +The identity endpoint also does not establish native correctness. + +Full selected cold replay (`make frontier1094-verify`), native 512-address +operators, whole-cover owner routing, physical hosting, precision/tape costs, +all-size/compiler interfaces, analytic transfer and a multiplication theorem +remain outside scope. The selected record and frozen predecessors are unchanged. +The family decision is **narrow**: retain this scalar evidence and require an +explicit native boundary before any sharing implementation or larger search. + +## Open next questions + +Can the first changed cut (time 10, stage 2, replica 0, centre 0) be reconstructed +with the actual routed native bridge and idle operators? This would test whether +the scalar witness has a native counterpart. Start from the pinned owner 224 +unit input and the exact route/phase maps through that cut, including both +bridge shears. The blocker is the cover/address action: treating it as identity +again would repeat this projection, not close the native question. A mismatch +would be a scoped counterexample, not a failure of the selected supplier. + +## Credit and overlap + +- Adam Gall, PR1918: original scalar projection and the separate output-rank lemma. +- thakrarsagar, PR2199 at `30ec048eedcaca970f94bbec0fdd3c52eacf9fdc`: + calls-only census and the explicit bridge/idle handoff. +- ywz65, PR2564 at `64f940a8ee305a1b69f7db329f1ffa232e53c2ad`: + terminal residual of two ablated calls, with bridge/idle events explicitly + omitted. This package neither redoes nor extends its ablation calculation. +- ywz65, [PR2622](https://github.com/CrocSwap/integer-mult-bounds/pull/2622) + at `4ffb893a08e8868057a30a065642d0b5f647f742`: already includes the complete + bridge-aware source-history rank and identity endpoint, as context for its + distinct output-error injectivity result. This package deliberately audits + the source-history claim with an independent local adjoint, coefficient + agreement and an endpoint/rank-preserving wrong-sign control. Neither checker + imports its code or the PR2199 verifier. The existing rank is not a new result. +- Rohan Arun, Jeremy Kothe, Hao Yan, Douglas Colkitt and the retained selected + construction/geometry lineage: exact scientific inputs and controller rules. + +[TASK.json](TASK.json) records the task selection, overlap coverage, scope and +freshness. The contribution uses two separately written algorithms by the same +AI-assisted author; no independent human or theorem-kernel review is claimed. +Prepared for BigCactusLabs with substantial OpenAI Codex assistance in research, +implementation, verification and exposition. New work is Apache-2.0. diff --git a/research/selected-centre-bridge-projection/RESULT.json b/research/selected-centre-bridge-projection/RESULT.json new file mode 100644 index 0000000000..a1f6bfd183 --- /dev/null +++ b/research/selected-centre-bridge-projection/RESULT.json @@ -0,0 +1,196 @@ +{ + "bridge_rank_pivot_columns_sha256": "7bdeddf3a162497990b47c23248c9d7103ee93e4150f72dc568ea3a50cf51420", + "bridge_rank_q": 1152, + "bridge_rows_sha256": "284565153a198a096bf8a336661582058d2fe395ba984bb355ca80c8f24f1cac", + "calls": 144, + "calls_only_nonidentity_owners": 14336, + "calls_only_rank_q": 1152, + "calls_only_rows_sha256": "ebcc83711debd6f2ff0e056f60af4f2e5d8a024cfb2846f117a524b5188909fd", + "centre_rows": 1152, + "changed_centre_calls": [ + 10, + 11, + 13, + 16, + 17, + 18, + 19, + 21, + 24, + 25, + 26, + 27, + 28, + 29, + 30, + 34, + 35, + 36, + 37, + 38, + 39, + 40, + 41, + 42, + 46, + 47, + 48, + 49, + 50, + 51, + 52, + 53, + 54, + 55, + 56, + 57, + 60, + 61, + 62, + 63, + 64, + 65, + 66, + 67, + 68, + 69, + 72, + 73, + 74, + 75, + 76, + 77, + 78, + 79, + 80, + 81, + 82, + 83, + 84, + 85, + 86, + 87, + 88, + 89, + 90, + 91, + 92, + 93, + 94, + 95, + 96, + 97, + 98, + 99, + 100, + 101, + 102, + 103, + 104, + 105, + 106, + 107, + 108, + 109, + 110, + 111, + 112, + 113, + 114, + 115, + 116, + 117, + 118, + 119, + 120, + 121, + 122, + 123, + 124, + 125, + 126, + 127, + 128, + 129, + 130, + 131, + 132, + 133, + 134, + 135, + 136, + 137, + 138, + 139, + 140, + 141, + 142, + 143 + ], + "changed_centre_rows": 930, + "controls": { + "duplicate_row_rank": 1, + "omitted_half_bridges_change_endpoint": 18 + }, + "event_counts": { + "bank_padding_cover_sweep": 1, + "bridge": 144, + "idle_cover_sweep": 160, + "local_cover_sweep": 144, + "terminal": 16, + "terminal_Y_translations": 16, + "translate_every_live_family": 1 + }, + "first_changed_basis_witness": { + "all_other_initial_owners": 0, + "bridge_cut_value": "1", + "calls_only_cut_value": "0", + "cut_time_stage_replica_centre": [ + 10, + 2, + 0, + 0 + ], + "initial_owner_with_value_one": 224 + }, + "full_projected_endpoint_identity_owners": 14336, + "local_event_counts": { + "backward": { + "adapter": 1090, + "center": 8, + "climb": 3486, + "phase": 10, + "residual_adapter": 480, + "scalar": 19693 + }, + "forward": { + "adapter": 1090, + "center": 8, + "climb": 3486, + "phase": 10, + "residual_adapter": 480, + "scalar": 19693 + } + }, + "scope": "Exact common-frame scalar projection; no native routing or supplier claim.", + "status": "PASS_SELECTED_CENTRE_BRIDGE_PROJECTION", + "template_payload_sha256": "9c4c51425251389ee9a747c465814cd07c64812c15b7aeef704dad7d65395a74", + "uniform_bridge_sign_reversal": { + "changed_centre_rows": 930, + "endpoint_identity_owners": 14336, + "first_changed_basis_witness": { + "all_other_initial_owners": 0, + "correct_cut_value": "1", + "cut_time_stage_replica_centre": [ + 10, + 2, + 0, + 0 + ], + "initial_owner_with_value_one": 224, + "reversed_bridge_cut_value": "-1" + }, + "rank_q": 1152, + "rows_sha256": "ea9798157c5c338cb8ccedda5437cd4c5d7d1138fd41e3c9df4376e0bd3bfbe9" + } +} diff --git a/research/selected-centre-bridge-projection/SOURCES.json b/research/selected-centre-bridge-projection/SOURCES.json new file mode 100644 index 0000000000..8f0ad310f8 --- /dev/null +++ b/research/selected-centre-bridge-projection/SOURCES.json @@ -0,0 +1,48 @@ +{ + "schema_version": 1, + "base_commit": "c3c94c2ea2ebcd5d69d1e51b5fe8a36bf79819f5", + "files": [ + { + "path": "certificates/selected-result.json", + "usage": "provenance", + "git_blob": "ae6a99f28aa468649eb66a361e764d769363bf11", + "sha256": "10b9e340fd8e354a37a0c4813c90e5de1dd42044b5f6aca4a3fc5a42b685fa32" + }, + { + "path": "docs/research/agent-task-catalog.json", + "usage": "provenance", + "git_blob": "889b95d936746df124872133ae1e7cc339adcb92", + "sha256": "7d185cd8c2af35988d638d969748ad7b670f902606444dbfc748e4402c340df6" + }, + { + "path": "research/community-frontier1094-audit/ASSEMBLY.json", + "usage": "input", + "git_blob": "5fd676df060f3b450782fdf5ff5f6beb63a5eeb0", + "sha256": "1122cb3a575f8c788345fc1bf4c108ac7c3250fb81a5988671f5eb04b3ab3045" + }, + { + "path": "research/community-frontier1094-audit/selected-replay.tar.gz", + "usage": "input", + "git_blob": "c24daf067f9c543421d89ca2eeaa4eb78a57fb6f", + "sha256": "f1da80610bf33c58527f18ad63b4350d0b864e1d4486141ee17ac9bed4d529d6" + }, + { + "path": "research/selected-centre-chrono-source-census/README.md", + "usage": "input", + "git_blob": "4fc0643eb118157575e60449820939809825a030", + "sha256": "0db44f2ce702ee1e5b11c9f8cd05517593bd259f45ae897437c58a1bd81b2943" + }, + { + "path": "research/selected-centre-chrono-source-census/RESULT.json", + "usage": "input", + "git_blob": "365355a43c37a8b689e70c9468f51f18b58a3ee6", + "sha256": "999984e40fc598cd7e65d6add7176d595cd2fada6b77cc13560b6dde11d70eb6" + }, + { + "path": "research/split-centres-global/proofs/INHERITED-COMPLEX-GEOMETRY.txt", + "usage": "input", + "git_blob": "c4150cb693414c098690eae79b3aea5f47c184ff", + "sha256": "c1ff55536594222a8d2a30bc0e0956959774e1be2d5420b7838ad553ee556df2" + } + ] +} diff --git a/research/selected-centre-bridge-projection/TASK.json b/research/selected-centre-bridge-projection/TASK.json new file mode 100644 index 0000000000..c24f96d4a7 --- /dev/null +++ b/research/selected-centre-bridge-projection/TASK.json @@ -0,0 +1,171 @@ +{ + "schema_version": 1, + "task_id": "centre-path-sharing", + "priority_revision": 5, + "base_commit": "c3c94c2ea2ebcd5d69d1e51b5fe8a36bf79819f5", + "original_card": { + "id": "centre-path-sharing", + "question": "Can the 64-per-call centre path (eight rank-8 COPY/ERASE totals through the private temporary) be shared across calls or shrunk?", + "starting_points": [ + "docs/research/research-family-status.md", + "research/complex-local-word-ceiling/README.md", + "research/split-centres-global/proofs/PR386-BIT-GEOMETRY.txt", + "certificates/selected-result.json" + ], + "methods": [ + "Derive a fully charged favorable relaxation for sharing one centre path across k calls, including restoration, hosting and precision.", + "Prove a lower bound on copied information per call for the selected decoder contract." + ], + "acceptance_gate": "Show the changed centre charge and copy profile per call with every added restoration or hosting cost charged, and its ceiling via ceiling.ceiling(centre=...). A scoped local result may be retained without a complete supplier. Expanding it into further construction rounds requires the family-level budget and obligation gate in research-family-status.md; an optimistic passing relaxation alone is not acceptance.", + "first_step": { + "command": [ + "python3", + "-B", + "research/complex-local-word-ceiling/verify.py" + ], + "expected": "PASS_COMPLEX_LOCAL_WORD_CEILING", + "inspect": "Read the selected word's per-call local profile, its packing ceiling and the lever table; run levers.py for the ideal budget of the lever you target.", + "scope": "Positive control and planning budget only; this is not a new construction or full cold replay." + }, + "first_experiment": "Write the per-call centre charge and copy children for sharing across k = 2 calls, charge the sharing overhead, and screen it; stop this route if even the ideal sharing gains under 10%. Ideal budgets: free 2.80x, shared by two 1.90x (levers.py).", + "bottleneck_link": "The centre path consumes 64 of about 99.6 unpaid coordinates per call, i.e. about 64% of the raw deficit.", + "allowed_variations": [ + "One sharing pattern across a fixed number of calls.", + "One reduced copied-total contract for the existing decoder.", + "If the coverage law, template or guard changes, derive an applicable fully charged replacement bound instead of applying the incumbent ceiling outside its scope." + ], + "scope_change_triggers": [ + "Removing copies without a replacement contract for the decoder's copied totals.", + "Continuing a partial cost improvement while leaving the same unpriced consumer, restoration or central-readout obligation unresolved; refresh the family expansion decision first. Local product-retiming evidence has a narrow scope and is not a ban on changed graphs or contracts." + ], + "overlap_terms": [ + "centre path", + "copied totals", + "private temporary", + "shared centre", + "batching" + ] + }, + "scope_status": "changed", + "actual_scope": "Independent audit of the complete common-frame scalar centre-source history reported in PR2622: forward rational and backward-adjoint/dense implementations agree on every coefficient; a uniform bridge-sign reversal preserves endpoint identity and full source rank while changing 930 rows.", + "scope_change_reason": "The final broad overlap search found PR2622 already reports the complete bridge-aware source-history rank. Retain the work as a deliberately independent audit, as autoresearch.md permits, rather than claiming to close an untouched PR2199 handoff. Neither checker imports predecessor code. The added value is independent local adjoint reconstruction and an endpoint/rank-preserving wrong-sign control. No sharing construction, native copy lower bound or saving is claimed.", + "bottleneck_link": "Determine whether a centre-information statistic survives the omitted controller shears before using it to guide centre sharing. No physical saving is claimed.", + "budget_minutes": 60, + "stop_rule": "About 60 minutes including orientation and packaging. Stop if bridge semantics cannot be pinned or exact checks fail. After overlap discovery, finish only the independent coefficient audit and semantic control; no new construction or native supplier expansion.", + "outcome": "completed", + "evidence": "Both implementations agree on all 1,152 source rows. Complete and uniformly sign-reversed controllers both have rank 1,152 and identity on 14,336 owners, but 930 rows differ; owner 224 changes the first affected cut from +1 to -1.", + "author": "BigCactusLabs with substantial OpenAI Codex assistance", + "ai_assistance": "Substantial OpenAI Codex assistance in investigation, implementation, proof exposition, validation and packaging; no independent human or theorem-kernel review.", + "open_questions": [ + { + "question": "Does the owner-224 unit-input witness at time 10 lift to the actual native routed bridge and idle operators?", + "why_it_matters": "The scalar projection does not certify native centre rank or physical reuse.", + "first_step": "Replay the pinned native route/phase maps through time 10, stage 2, replica 0, centre 0 with both bridge shears.", + "blocked_by": "An explicit cover/address boundary and the actual nonidentity idle and phase operators." + } + ], + "seed": "283c37d7bfe9aa29a7d597e3ec17d33b", + "track": "recursive-interfaces", + "plan": [ + "Pin selected local programs, actual call ownership and bridge/terminal semantics.", + "Reconstruct complete source coefficients with forward rational and independent local-adjoint/dense-controller algorithms.", + "Verify the endpoint/rank-preserving wrong-sign control and package the bounded independent audit with predecessor credit." + ], + "predecessors": [ + { + "pr": 2199, + "head": "30ec048eedcaca970f94bbec0fdd3c52eacf9fdc", + "author": "thakrarsagar", + "scope": "Calls-only global centre-source rank census; open next question 1" + }, + { + "pr": 1918, + "author": "Adam Gall", + "scope": "Common-frame scalar projection and distinct output-rank information lemma" + }, + { + "pr": 2564, + "head": "64f940a8ee305a1b69f7db329f1ffa232e53c2ad", + "author": "ywz65", + "scope": "Terminal residual after two ablated calls; explicitly omits bridge/idle events" + }, + { + "pr": 2622, + "head": "4ffb893a08e8868057a30a065642d0b5f647f742", + "author": "ywz65", + "scope": "Prior complete scalar source-history rank and identity endpoint; separate final output-error injectivity is not audited here.", + "readme_sha256": "95abe3e80f7d3313b1cbdba309cb83e0eb5c9abf0abdc6235dae3c0319388ae9", + "endpoint_py_sha256": "a35bc70789b640446c14b3f2d727f29b02507670958fbcaa996c51f74cf56a1f" + } + ], + "overlap": { + "checked_at": "2026-10-15T18:30:25.808600+00:00", + "coverage": { + "open_prs": { + "fetched_at": "2026-10-15T18:28:13.952605+00:00", + "complete_pagination": true, + "records": 766 + }, + "discussions": { + "fetched_at": "2026-10-15T18:30:25.699186+00:00", + "complete_pagination": true, + "records": 1344 + } + }, + "warnings": [], + "specific_searches": [ + "chrono-source", + "calls-only", + "owner-level scalar", + "bridges and idle", + "terminal quotient", + "centre AND bridge", + "adjoint", + "sign reversal", + "bridge signs" + ], + "nearest": "PR2622 already reports the bridge-aware source-history rank. This is a deliberate independent adjoint audit plus a distinct endpoint/rank-preserving semantic control, not a priority claim.", + "claim_status": "LOCAL-ONLY; no public claim posted because the donor requires confirmation before shared-state actions.", + "focused_search_note": "Adjoint/sign searches used the same cached remote snapshot at 18:34:29 UTC, marked offline; full refreshed coverage is dated above. No novelty certificate is claimed." + }, + "family_expansion_decision": "narrow: retain scalar evidence only; no sharing implementation without native boundary and complete costs", + "unchanged_centre_rank_mass": 9216, + "upstream_refresh": { + "checked_at": "2026-10-15T18:34:29Z", + "main_commit": "b62dcc58a6beecfcae79627042bf9c48d0e71e6f", + "priority_revision": 5, + "relevant_changes": "No changes from the experiment base in AGENTS.md, autoresearch.md, task catalog, selected record, replay inputs, PR2199 inputs or geometry proof. Continue narrowed independent audit." + }, + "scope_key": "a55534776f5479f1686c", + "validation": { + "platform": "macOS arm64", + "final_implementation_runs": [ + { + "python": "CPython 3.12.13", + "command": "python3.12 -B scripts/research_package.py --package research/selected-centre-bridge-projection", + "result": "PASS_REGISTERED_RESEARCH_PACKAGE; primary normal and independent adjoint under -O both pass" + }, + { + "python": "CPython 3.11.15", + "command": "python3.11 -I -O -B research/selected-centre-bridge-projection/verify.py", + "result": "PASS_SELECTED_CENTRE_BRIDGE_PROJECTION rank=1152 changed_rows=930 endpoint_owners=14336" + }, + { + "python": "CPython 3.11.15", + "command": "python3.11 -I -O -B research/selected-centre-bridge-projection/check_adjoint.py", + "result": "PASS_SELECTED_CENTRE_BRIDGE_ADJOINT rows=1152 rank_mod_2147483647=1152 controls=3" + } + ], + "orientation_controls": [ + "python3 -B scripts/research_baseline.py: PASS_RESEARCH_BASELINE_BINDINGS_ONLY", + "python3 -B research/complex-local-word-ceiling/verify.py: PASS_COMPLEX_LOCAL_WORD_CEILING" + ], + "not_run": [ + "make verify", + "make frontier1094-verify", + "Native 512-address or full owner-routing replay", + "Upstream CI", + "Human or theorem-kernel proof review" + ] + } +} diff --git a/research/selected-centre-bridge-projection/VERIFY.json b/research/selected-centre-bridge-projection/VERIFY.json new file mode 100644 index 0000000000..a9e7cc4fb8 --- /dev/null +++ b/research/selected-centre-bridge-projection/VERIFY.json @@ -0,0 +1,36 @@ +{ + "schema_version": 1, + "status": "ready", + "python": "3.12", + "requirements": [], + "inputs": [ + "research/community-frontier1094-audit/ASSEMBLY.json", + "research/community-frontier1094-audit/selected-replay.tar.gz", + "research/selected-centre-chrono-source-census/README.md", + "research/selected-centre-chrono-source-census/RESULT.json", + "research/split-centres-global/proofs/INHERITED-COMPLEX-GEOMETRY.txt" + ], + "commands": [ + { + "argv": [ + "{python}", + "-I", + "-B", + "{package}/verify.py" + ], + "timeout_seconds": 120, + "checks": "Exact local maps, chronological bridges, all-owner identity, rational ranks, source pins, receipt, 18 omission controls and endpoint/rank-preserving wrong-sign witness." + }, + { + "argv": [ + "{python}", + "-I", + "-O", + "-B", + "{package}/check_adjoint.py" + ], + "timeout_seconds": 120, + "checks": "Separate adjoint/dense reconstruction of all correct and wrong-sign centre rows, both modular ranks, bridge/sign/dependency controls under optimized Python." + } + ] +} diff --git a/research/selected-centre-bridge-projection/check_adjoint.py b/research/selected-centre-bridge-projection/check_adjoint.py new file mode 100644 index 0000000000..740a7b39dd --- /dev/null +++ b/research/selected-centre-bridge-projection/check_adjoint.py @@ -0,0 +1,203 @@ +#!/usr/bin/env python3 +"""Separate adjoint-cut and dense-controller reconstruction. Apache-2.0. + +No import from the primary checker or supplier implementation. +Prepared for BigCactusLabs with substantial OpenAI Codex assistance. +""" +from fractions import Fraction +import gzip +import hashlib +import json +from pathlib import Path +import tarfile + +PACKAGE = Path(__file__).resolve().parent +REPOSITORY = PACKAGE.parents[1] + + +def check(ok, message): + if not ok: + raise ValueError(message) + + +def encode(value): + return json.dumps(value, sort_keys=True, separators=(',', ':')).encode() + + +def sha(raw): + return hashlib.sha256(raw).hexdigest() + + +def add_term(vector, key, amount): + value = vector.get(key, Fraction(0)) + amount + if value: + vector[key] = value + else: + vector.pop(key, None) + + +def adjoint_cut(program, cut): + weights = {('C', program[cut][1]): Fraction(1)} + for event in reversed(program[:cut]): + if event[0] != 'scalar': + check(event[0] in ('phase', 'center', 'climb', 'adapter', 'residual_adapter'), + 'unknown local event') + continue + op = event[1] + dest = tuple(op[1]) + weight = weights.get(dest, Fraction(0)) + if op[0] == 'add': + add_term(weights, tuple(op[2]), weight * Fraction(op[3], op[4])) + elif op[0] == 'scale': + if weight: + weights[dest] = weight * Fraction(op[2], op[3]) + elif op[0] == 'copy': + weights.pop(dest, None) + add_term(weights, tuple(op[2]), weight) + elif op[0] == 'clear': + weights.pop(dest, None) + else: + raise ValueError('unknown scalar operation') + check(all(kind == 'L' for kind, index in weights), 'cut depends on initial private state') + return {index: weight for (kind, index), weight in weights.items() if weight} + + +def identity(): + return [[int(i == j) for j in range(8)] for i in range(8)] + + +def multiply(left, right): + return [[sum(left[i][k] * right[k][j] for k in range(8)) + for j in range(8)] for i in range(8)] + + +def reconstruct(template, programs, bridge_sign=1): + cuts = {} + for orient in ('forward', 'backward'): + locations = {event[1]: i for i, event in enumerate(programs[orient]) if event[0] == 'center'} + check(sorted(locations) == list(range(8)), 'centre locations differ') + cuts[orient] = [adjoint_cut(programs[orient], locations[k]) for k in range(8)] + states = [identity() for _ in range(16)] + calls = {call['time']: call for call in template['calls']} + all_rows = [] + for event in template['execution_schedule']: + kind = event['kind'] + if kind == 'local_cover_sweep': + call = calls[event['time']] + orient = call['orientation'] + check(sha(encode(programs[orient])) == call['local_program_sha256'], 'program binding differs') + for cut in cuts[orient]: + row = {} + for local_role, weight in cut.items(): + physical = call['owners'][local_role][0] + rep, remainder = divmod(physical, 896) + component, port = divmod(remainder, 112) + for initial_component, coefficient in enumerate(states[rep][component]): + add_term(row, rep * 896 + initial_component * 112 + port, + weight * coefficient) + all_rows.append(row) + transform = identity() + component = 2 * call['pair'] + if orient == 'forward': + transform[component + 1][component] = 1 + else: + transform[component][component + 1] = -1 + rep = call['replica'] + states[rep] = multiply(transform, states[rep]) + elif kind == 'bridge': + transform = identity() + dst, src = 2 * event['dst'], 2 * event['src'] + transform[dst][src] = event['coefficient'] * bridge_sign + transform[src + 1][dst + 1] = -event['coefficient'] * bridge_sign + rep = event['replica'] + states[rep] = multiply(transform, states[rep]) + elif kind == 'terminal': + transform = [[0] * 8 for _ in range(8)] + for pair in range(4): + transform[2 * pair][2 * pair + 1] = 1 + transform[2 * pair + 1][2 * pair] = -1 + rep = event['replica'] + states[rep] = multiply(transform, states[rep]) + else: + check(kind in ('idle_cover_sweep', 'terminal_Y_translations', + 'bank_padding_cover_sweep', 'translate_every_live_family'), 'unknown global event') + return all_rows, states + + +def modular_rank(rows): + # A nonzero 1152-minor mod this prime is a lower bound for rational rank, + # since every denominator is nonzero mod p. Together with 1152 rows it is exact. + p = 2147483647 + basis = {} + for original in reversed(rows): + row = {} + for col, q in original.items(): + check(q.denominator % p != 0, 'noninvertible denominator') + value = q.numerator * pow(q.denominator, -1, p) % p + if value: + row[col] = value + while row: + pivot = max(row) + if pivot not in basis: + inverse = pow(row[pivot], -1, p) + basis[pivot] = {k: v * inverse % p for k, v in row.items()} + break + multiple = row[pivot] + for k, v in basis[pivot].items(): + value = (row.get(k, 0) - multiple * v) % p + if value: + row[k] = value + else: + row.pop(k, None) + return len(basis) + + +def fingerprint(rows): + return sha(encode([[[i, str(q)] for i, q in sorted(row.items())] for row in rows])) + + +def main(): + sources = json.loads((PACKAGE / 'SOURCES.json').read_text()) + for item in sources['files']: + if item['usage'] == 'input': + check(sha((REPOSITORY / item['path']).read_bytes()) == item['sha256'], 'source hash differs') + with tarfile.open(REPOSITORY / 'research/community-frontier1094-audit/selected-replay.tar.gz') as archive: + template_bytes = gzip.decompress(archive.extractfile('candidate/strict/global/hosted/GLOBAL-TEMPLATE.json.gz').read()) + programs = json.loads(gzip.decompress(archive.extractfile('candidate/strict/global/base/providers/gauge44/LOCAL-PROGRAMS.json.gz').read())) + template = json.loads(template_bytes) + receipt = json.loads((PACKAGE / 'RESULT.json').read_text()) + check(sha(template_bytes) == receipt['template_payload_sha256'], 'template binding differs') + rows, states = reconstruct(template, programs) + check(all(state == identity() for state in states), 'dense controller endpoint differs') + check(fingerprint(rows) == receipt['bridge_rows_sha256'], 'adjoint rows differ from forward rows') + check(len(rows) == modular_rank(rows) == receipt['bridge_rank_q'] == 1152, 'rank certificate differs') + # These mutations retain all local calls; they change only the bridge semantics. + for sign in (0, -1): + bad_rows, bad_states = reconstruct(template, programs, sign) + check(fingerprint(bad_rows) != fingerprint(rows), 'bridge mutation did not change cuts') + if sign == 0: + check(any(state != identity() for state in bad_states), 'omitted bridges did not change endpoint') + else: + # Uniform reversal is conjugation by alternating pair signs. + # Endpoint identity alone cannot detect this wrong cut computation. + check(all(state == identity() for state in bad_states), 'sign-conjugate endpoint differs') + control = receipt['uniform_bridge_sign_reversal'] + check(fingerprint(bad_rows) == control['rows_sha256'], 'sign-control rows differ') + check(modular_rank(bad_rows) == control['rank_q'] == 1152, 'sign-control rank differs') + check(sum(a != b for a, b in zip(rows, bad_rows)) == control['changed_centre_rows'], + 'sign-control changed-row count differs') + witness = control['first_changed_basis_witness'] + time, stage, replica, centre = witness['cut_time_stage_replica_centre'] + call = next(c for c in template['calls'] if c['time'] == time) + check((call['stage'], call['replica']) == (stage, replica), 'sign-control cut label differs') + position = 8 * time + centre + column = witness['initial_owner_with_value_one'] + check(str(rows[position].get(column, Fraction(0))) == witness['correct_cut_value'] + and str(bad_rows[position].get(column, Fraction(0))) + == witness['reversed_bridge_cut_value'], 'sign-control basis witness differs') + check(modular_rank(rows[:8] + rows[:8]) == 8, 'dependent-row control failed') + print('PASS_SELECTED_CENTRE_BRIDGE_ADJOINT rows=1152 rank_mod_2147483647=1152 controls=3') + + +if __name__ == '__main__': + main() diff --git a/research/selected-centre-bridge-projection/verify.py b/research/selected-centre-bridge-projection/verify.py new file mode 100644 index 0000000000..38a64ae8ed --- /dev/null +++ b/research/selected-centre-bridge-projection/verify.py @@ -0,0 +1,346 @@ +#!/usr/bin/env python3 +"""Exact scalar controller projection, not a native supplier replay. + +Prepared for BigCactusLabs with substantial OpenAI Codex assistance. Apache-2.0. +Projection: Adam Gall / PR1918 and thakrarsagar / PR2199. +""" +import argparse +from collections import Counter +from fractions import Fraction as Q +import gzip +import hashlib +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/' +MEMBERS = { + 'template': (PREFIX + 'hosted/GLOBAL-TEMPLATE.json.gz', + '2acf02b418078e37090495c601fe550448751d4f35912757b13a1f778efc7760'), + 'programs': (PREFIX + 'base/providers/gauge44/LOCAL-PROGRAMS.json.gz', + '241fde27d4e43f5a9cb6b128f9f76c5131a53d09f0371676163f914d0b0fef3a'), + 'word': (PREFIX + 'base/providers/gauge44/CANONICAL-WORD.json.gz', + '16bc0ebb04b4be6c0ade74badc6a0c0cdba4215eda86e4ff9f13abf8ecebd219'), +} +IDENTITY_LOCAL = {'climb', 'adapter', 'residual_adapter'} +IDENTITY_GLOBAL = {'idle_cover_sweep', 'terminal_Y_translations', + 'bank_padding_cover_sweep', 'translate_every_live_family'} +STATUS = 'PASS_SELECTED_CENTRE_BRIDGE_PROJECTION' + + +def require(ok, message): + if not ok: + raise ValueError(message) + + +def digest(raw): + return hashlib.sha256(raw).hexdigest() + + +def canonical(value): + return json.dumps(value, sort_keys=True, separators=(',', ':')).encode() + + +def axpy(target, source, coefficient): + for column, value in source.items(): + value = target.get(column, Q(0)) + coefficient * value + if value: + target[column] = value + else: + target.pop(column, None) + + +def scaled(row, factor): + return {column: value * factor for column, value in row.items() if value * factor} + + +def rank(rows): + """Exact rational elimination; no float or modular rank decisions.""" + basis = {} + for incoming in rows: + row = incoming.copy() + while row: + pivot = min(row) + if pivot not in basis: + basis[pivot] = scaled(row, 1 / row[pivot]) + break + axpy(row, basis[pivot], -row[pivot]) + return len(basis), sorted(basis) + + +def rows_digest(rows): + return digest(canonical([[[i, str(q)] for i, q in sorted(row.items())] for row in rows])) + + +def load(): + pins = json.loads((HERE / 'SOURCES.json').read_text()) + for source in pins['files']: + if source['usage'] == 'input': + require(digest((ROOT / source['path']).read_bytes()) == source['sha256'], + 'source pin mismatch: ' + source['path']) + data = {} + with tarfile.open(ROOT / ARCHIVE) as archive: + for key, (name, expected) in MEMBERS.items(): + stream = archive.extractfile(name) + require(stream is not None, 'missing archive member: ' + name) + raw = stream.read() + require(digest(raw) == expected, 'archive member mismatch: ' + name) + payload = gzip.decompress(raw) + data[key] = json.loads(payload) + if key == 'template': + data['template_payload_sha256'] = digest(payload) + assembly = json.loads((ROOT / 'research/community-frontier1094-audit/ASSEMBLY.json').read_text()) + require(data['template_payload_sha256'] == assembly['template_sha256'], + 'assembly does not bind the template') + require(data['word']['R'] == 480, 'expected selected 480-helper word') + return data + + +def local_forms(program, orientation): + """Interpret literal scalar events on all 704 formal input columns.""" + state = {('L', i): {i: Q(1)} for i in range(704)} + cuts = {} + inventory = Counter() + for event in program: + tag = event[0] + inventory[tag] += 1 + if tag == 'scalar': + op = event[1] + action, dst = op[0], tuple(op[1]) + if action == 'clear': + state[dst] = {} + elif action == 'copy': + state[dst] = state[tuple(op[2])].copy() + elif action == 'scale': + state[dst] = scaled(state[dst], Q(op[2], op[3])) + elif action == 'add': + src = tuple(op[2]) + require(dst != src, 'aliased scalar addition') + axpy(state[dst], state[src], Q(op[3], op[4])) + else: + raise ValueError('unknown scalar operation: ' + action) + elif tag == 'center': + k = event[1] + require(k not in cuts and event[4] == 8, 'invalid centre event') + cuts[k] = state['C', k].copy() + else: + require(tag == 'phase' or tag in IDENTITY_LOCAL, 'unknown local event') + require(sorted(cuts) == list(range(8)), 'missing centre cuts') + require(all(not row for (kind, _), row in state.items() if kind != 'L'), + 'private workspace not cleared') + for i in range(704): + expected = {i: Q(1)} + if orientation == 'forward' and 112 <= i < 224: + expected[i - 112] = Q(1) + if orientation == 'backward' and i < 112: + expected[i + 112] = Q(-1) + require(state['L', i] == expected, orientation + ' local endpoint mismatch') + return [cuts[k] for k in range(8)], dict(sorted(inventory.items())) + + +def owner(replica, pair, side, port): + return replica * 896 + (2 * pair + side) * 112 + port + + +def validate_schedule(template, programs): + require(template['live'] == 14336, 'physical-owner domain changed') + calls = {call['time']: call for call in template['calls']} + require(len(template['calls']) == 144 and sorted(calls) == list(range(144)), 'call times not bijective') + hashes = {key: digest(canonical(programs[key])) for key in ('forward', 'backward')} + per_replica = {replica: [] for replica in range(16)} + seen = [] + for event in template['execution_schedule']: + kind = event['kind'] + if kind == 'local_cover_sweep': + call = calls[event['time']] + for key in ('provider_id', 'replica', 'stage', 'time'): + require(call[key] == event[key], 'call/schedule mismatch: ' + key) + require(call['provider_id'] == 'gauge44', 'unknown provider') + require(call['local_program_sha256'] == hashes[call['orientation']], 'call/program binding mismatch') + require(call['orientation'] == ('backward' if call['stage'] % 2 else 'forward'), 'orientation mismatch') + ids = [entry[0] for entry in call['owners']] + require(len(ids) == len(set(ids)) == 704, 'aliased local roles') + require(all(type(i) is int and 0 <= i < 14336 for i in ids), 'owner out of range') + expected = [owner(call['replica'], call['pair'], side, port) for side in range(2) for port in range(112)] + require(ids[:224] == expected, 'data layout does not match bridge ports') + per_replica[call['replica']].append(dict(kind='local', pair=call['pair'], + reverse=call['orientation'] == 'backward', stage=call['stage'])) + seen.append(call['time']) + elif kind in ('bridge', 'terminal'): + require(event['replicas'] == [event['replica']], 'ambiguous event replica') + keys = ('kind', 'src', 'dst', 'coefficient') if kind == 'bridge' else ('kind', 'pairs') + per_replica[event['replica']].append({key: event[key] for key in keys}) + else: + require(kind in IDENTITY_GLOBAL, 'unknown global event: ' + kind) + require(seen == list(range(144)), 'chronological calls changed') + require(all(recipe == template['recipe'] for recipe in per_replica.values()), 'replica controller mismatch') + return calls + + +def run_projection(template, calls, forms, with_bridges, bridge_sign=1): + physical = [{i: Q(1)} for i in range(14336)] + rows, labels = [], [] + for event in template['execution_schedule']: + kind = event['kind'] + if kind == 'local_cover_sweep': + call = calls[event['time']] + ids = [entry[0] for entry in call['owners']] + orientation = call['orientation'] + for k, form in enumerate(forms[orientation]): + row = {} + for role, coefficient in form.items(): + axpy(row, physical[ids[role]], coefficient) + rows.append(row) + labels.append([call['time'], call['stage'], call['replica'], k]) + for port in range(112): + dst, src, sign = ((ids[112 + port], ids[port], 1) if orientation == 'forward' + else (ids[port], ids[112 + port], -1)) + axpy(physical[dst], physical[src], sign) + elif with_bridges and kind == 'bridge': + rep, dst, src, sign = (event[k] for k in ('replica', 'dst', 'src', 'coefficient')) + sign *= bridge_sign + for port in range(112): + axpy(physical[owner(rep, dst, 0, port)], physical[owner(rep, src, 0, port)], sign) + axpy(physical[owner(rep, src, 1, port)], physical[owner(rep, dst, 1, port)], -sign) + elif with_bridges and kind == 'terminal': + for pair in range(4): + for port in range(112): + x, y = (owner(event['replica'], pair, side, port) for side in (0, 1)) + physical[x], physical[y] = physical[y], scaled(physical[x], -1) + # Address/frame/phase events are identities in this projection only. + return rows, labels, physical + + +def controller(recipe, omit=None): + """Separate 8-by-8 controller check; omit one of the 18 half-bridges.""" + matrix = [{i: Q(1)} for i in range(8)] + bridge_half = 0 + for event in recipe: + kind = event['kind'] + if kind == 'local': + x = 2 * event['pair'] + if event['reverse']: + axpy(matrix[x], matrix[x + 1], -1) + else: + axpy(matrix[x + 1], matrix[x], 1) + elif kind == 'bridge': + dst, src, sign = event['dst'], event['src'], event['coefficient'] + for a, b, q in ((2 * dst, 2 * src, sign), (2 * src + 1, 2 * dst + 1, -sign)): + if bridge_half != omit: + axpy(matrix[a], matrix[b], q) + bridge_half += 1 + elif kind == 'terminal': + for pair in range(4): + x = 2 * pair + matrix[x], matrix[x + 1] = matrix[x + 1], scaled(matrix[x], -1) + else: + raise ValueError('unknown recipe event') + return matrix, bridge_half + + +def result(data): + template, programs = data['template'], data['programs'] + forms, local_counts = {}, {} + for orientation in ('forward', 'backward'): + forms[orientation], local_counts[orientation] = local_forms(programs[orientation], orientation) + calls = validate_schedule(template, programs) + full, labels, final = run_projection(template, calls, forms, True) + old, old_labels, old_final = run_projection(template, calls, forms, False) + require(labels == old_labels, 'comparison cut labels differ') + predecessor = json.loads((ROOT / 'research/selected-centre-chrono-source-census/RESULT.json').read_text()) + support_histogram = {str(k): v for k, v in Counter(map(len, old)).items()} + require(support_histogram == predecessor['centre_row_support_size_histogram'], + 'calls-only predecessor support histogram differs') + require({key: list(map(len, value)) for key, value in forms.items()} + == predecessor['local_centre_input_support_sizes'], 'local cut support sizes differ') + call_table = [[index, event['time'], event['stage'], event['replica'], + calls[event['time']]['orientation'], calls[event['time']]['pair']] + for index, event in enumerate(template['execution_schedule']) + if event['kind'] == 'local_cover_sweep'] + require(call_table == predecessor['call_table'], 'predecessor call chronology differs') + require(all(row == {i: Q(1)} for i, row in enumerate(final)), 'full projected endpoint is not identity') + old_rank, _ = rank(old) + require(old_rank == 1152, 'calls-only predecessor rank not reproduced') + full_rank, pivots = rank(full) + require(full_rank == 1152, 'complete centre-source rank differs') + reversed_rows, reversed_labels, reversed_final = run_projection( + template, calls, forms, True, bridge_sign=-1) + require(reversed_labels == labels, 'sign-control cut labels differ') + require(all(row == {i: Q(1)} for i, row in enumerate(reversed_final)), + 'uniform sign reversal did not preserve endpoint identity') + reversed_rank, _ = rank(reversed_rows) + require(reversed_rank == 1152, 'uniform sign reversal did not preserve full source rank') + reversed_changed = [i for i, (a, b) in enumerate(zip(full, reversed_rows)) if a != b] + require(reversed_changed, 'uniform sign reversal did not change cuts') + changed_index = reversed_changed[0] + good_row, bad_row = full[changed_index], reversed_rows[changed_index] + witness_column = min(k for k in good_row.keys() | bad_row.keys() + if good_row.get(k, 0) != bad_row.get(k, 0)) + first_changed = next(i for i, (a, b) in enumerate(zip(old, full)) if a != b) + old_row, new_row = old[first_changed], full[first_changed] + first_column = min(k for k in old_row.keys() | new_row.keys() + if old_row.get(k, 0) != new_row.get(k, 0)) + matrix, halves = controller(template['recipe']) + identity = [{i: Q(1)} for i in range(8)] + require(matrix == identity and halves == 18, 'signed controller does not close') + require(all(controller(template['recipe'], i)[0] != identity for i in range(18)), + 'omitted half-bridge did not change endpoint') + require(rank([full[0], full[0]])[0] == 1, 'duplicate-row rank control failed') + return { + 'status': STATUS, + 'scope': 'Exact common-frame scalar projection; no native routing or supplier claim.', + 'template_payload_sha256': data['template_payload_sha256'], + 'event_counts': dict(sorted(Counter(e['kind'] for e in template['execution_schedule']).items())), + 'local_event_counts': local_counts, + 'calls': len(calls), 'centre_rows': len(full), + 'full_projected_endpoint_identity_owners': len(final), + 'calls_only_nonidentity_owners': sum(row != {i: Q(1)} for i, row in enumerate(old_final)), + 'calls_only_rank_q': old_rank, 'bridge_rank_q': full_rank, + 'bridge_rank_pivot_columns_sha256': digest(canonical(pivots)), + 'changed_centre_rows': sum(a != b for a, b in zip(full, old)), + 'first_changed_basis_witness': { + 'cut_time_stage_replica_centre': labels[first_changed], + 'initial_owner_with_value_one': first_column, + 'all_other_initial_owners': 0, + 'calls_only_cut_value': str(old_row.get(first_column, Q(0))), + 'bridge_cut_value': str(new_row.get(first_column, Q(0))), + }, + 'changed_centre_calls': sorted({label[0] for label, a, b in zip(labels, full, old) if a != b}), + 'calls_only_rows_sha256': rows_digest(old), 'bridge_rows_sha256': rows_digest(full), + 'uniform_bridge_sign_reversal': { + 'rank_q': reversed_rank, + 'endpoint_identity_owners': len(reversed_final), + 'changed_centre_rows': len(reversed_changed), + 'rows_sha256': rows_digest(reversed_rows), + 'first_changed_basis_witness': { + 'cut_time_stage_replica_centre': labels[changed_index], + 'initial_owner_with_value_one': witness_column, + 'all_other_initial_owners': 0, + 'correct_cut_value': str(good_row.get(witness_column, Q(0))), + 'reversed_bridge_cut_value': str(bad_row.get(witness_column, Q(0))), + }, + }, + 'controls': {'omitted_half_bridges_change_endpoint': 18, 'duplicate_row_rank': 1}, + } + + +def main(): + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument('--write', action='store_true', help='regenerate exact receipt') + args = parser.parse_args() + receipt = result(load()) + path = HERE / 'RESULT.json' + if args.write: + path.write_text(json.dumps(receipt, indent=2, sort_keys=True) + '\n') + else: + require(receipt == json.loads(path.read_text()), 'result receipt differs') + print(STATUS, 'rank=' + str(receipt['bridge_rank_q']), + 'changed_rows=' + str(receipt['changed_centre_rows']), + 'endpoint_owners=' + str(receipt['full_projected_endpoint_identity_owners'])) + + +if __name__ == '__main__': + main()