From 6b832a6ba4dce8dd6e2fb0897dd4543364b932f8 Mon Sep 17 00:00:00 2001 From: Brody Arbon <146895390+Brodee042@users.noreply.github.com> Date: Mon, 12 Oct 2026 23:17:19 -0700 Subject: [PATCH] research: tighten conditional replica prefix estimate to 160 bits Audit the pinned #626 construction at 66849e1475c930fd7732b1a0067ffee7e1e95f60. Production reserve and current frontier are unchanged. No new kappa. Prepared by Brody Arbon with substantial OpenAI Codex assistance. Source tree matches local verified commit 550ae5e3c5680470d902141802e7d86e8133c303. --- research/replica-prefix-audit/CLAIM.md | 74 ++++ research/replica-prefix-audit/EXPECTED.json | 179 ++++++++++ research/replica-prefix-audit/NOTICE.md | 33 ++ research/replica-prefix-audit/OVERLAP.json | 203 +++++++++++ research/replica-prefix-audit/PROOF.md | 178 +++++++++ research/replica-prefix-audit/README.md | 93 +++++ research/replica-prefix-audit/SOURCES.json | 103 ++++++ research/replica-prefix-audit/VALIDATION.md | 51 +++ research/replica-prefix-audit/model_checks.py | 338 ++++++++++++++++++ research/replica-prefix-audit/test_package.py | 94 +++++ research/replica-prefix-audit/verify.py | 239 +++++++++++++ 11 files changed, 1585 insertions(+) create mode 100644 research/replica-prefix-audit/CLAIM.md create mode 100644 research/replica-prefix-audit/EXPECTED.json create mode 100644 research/replica-prefix-audit/NOTICE.md create mode 100644 research/replica-prefix-audit/OVERLAP.json create mode 100644 research/replica-prefix-audit/PROOF.md create mode 100644 research/replica-prefix-audit/README.md create mode 100644 research/replica-prefix-audit/SOURCES.json create mode 100644 research/replica-prefix-audit/VALIDATION.md create mode 100644 research/replica-prefix-audit/model_checks.py create mode 100644 research/replica-prefix-audit/test_package.py create mode 100644 research/replica-prefix-audit/verify.py diff --git a/research/replica-prefix-audit/CLAIM.md b/research/replica-prefix-audit/CLAIM.md new file mode 100644 index 0000000000..f7e86c229d --- /dev/null +++ b/research/replica-prefix-audit/CLAIM.md @@ -0,0 +1,74 @@ +# Sprint claim and result — seed 72 + +Track: adversarial mathematical audit. +Base: `66849e1475c930fd7732b1a0067ffee7e1e95f60`. +OS randomness: `System.Security.Cryptography.RandomNumberGenerator`, +uniform UInt32 rejection below 4294967200, modulo 100. Assignment: **72**. + +Started 2026-10-13 05:32:30 UTC (2026-10-12 22:32 PDT), with a 40-minute +budget and the final quarter reserved for verification and handoff. +Narrow scope was recorded locally during the initial orientation period. +Expected finish: 2026-10-13 06:12:30 UTC / 2026-10-12 23:12 PDT. + +The three candidates were moment-profile input validation, global scalar +growth accounting, and cyclic-inverse phase assumptions. The first and +third had extensive adjacent current work. The chosen object is the +selected `GLOBAL-PREFIX.json` and `invoice_allcold.py` allowance +`101 + 37 + 72 + 72 + 4 = 286`. Seed 72 selected inspection of the +complete 72-call interleaving and terminal boundaries rather than a new +frontier word or local scalar rewrite. This was an audit, not a randomized +search; there is no seed-dependent probability claim. + +Hypothesis: counters per replica can replace the global sweep-factor sum +under the inherited arbitrary-dirt and normalized helper interfaces. +Method: source-pinned schedule/owner checks, a norm induction, exact +finite dirty-helper models and adverse controls. All delegated work +stayed within this prefix-accounting scope. The stopping rule was to +complete this one proof/certificate package after accepting or rejecting +the hypothesis; no new supplier, owner search or kappa search was opened. + +There was no pinned sprint coordination issue; the open issue query found +only #650 (Discussions). The claim and this single outcome update are +therefore local, as permitted by the sprint instructions. No reservation +issue or unsolicited comment was posted. + +## Outcome + +The qualified hypothesis is supported: **160 bits** suffice in the same +conditional prefix model, a 126-bit reduction of the estimate. Physical +helpers may have nonidentity familywise unitary residuals, so the proof +does not assume physical identity restoration. It keeps the independent +local prefix allowance and explicitly excludes arbitrary cross-family +unitary mixing. No selected constant or kappa is changed. + +Completed coverage: 72 call bindings, 240 scheduled events, 35,424 helper +roles, 12 schedule/admission controls, 8 exact signed gadgets, all six +two-by-two-call interleavings with 24 completed boundaries and 384 exact +norm sample comparisons, plus six adverse mathematical controls. +The written induction supplies the dimension-independent result; +finite coverage is not a formal theorem proof or full supplier replay. + +The final metadata scan at 05:54:42 UTC covered 621 open PRs through #802, +with a final empty pagination page. Matching contexts were inspected, +and #496's exact prior proof was read and credited. Its global norm +method is foundational; this result adds per-replica counters for the +selected asynchronous construction. #675 and #696/#734/#783 have distinct +owner-boundary and local circuit/counting scopes. [OVERLAP.json](OVERLAP.json) +records heads and search results. No overlapping 286-to-160 result was +identified; this is not an exhaustive literature or code novelty claim. +Before packaging, the 100 most recently updated open PRs were refreshed +through #809; the newly updated titles/bodies produced no additional +replica/global-prefix match. The refreshed heads are retained in the +overlap record. + +The research and clean-patch handoff completed within the original budget. +Publication resumed after the user supplied a writable fork. Upstream had +meanwhile adopted a newer frontier; this contribution retains its original +base and audits the now-historical #626 construction. It claims no estimate +for the newer frontier. The final submission refresh is recorded in +`OVERLAP.json`. + +Deliverable: [proof](PROOF.md), [checker](verify.py), and +[exact receipt](EXPECTED.json), with source pins and validation details. +Contributor: Brody Arbon, with substantial OpenAI Codex assistance. +Apache-2.0; no independent human review is claimed. diff --git a/research/replica-prefix-audit/EXPECTED.json b/research/replica-prefix-audit/EXPECTED.json new file mode 100644 index 0000000000..3943187189 --- /dev/null +++ b/research/replica-prefix-audit/EXPECTED.json @@ -0,0 +1,179 @@ +{ + "assignment_seed": 72, + "base_commit": "66849e1475c930fd7732b1a0067ffee7e1e95f60", + "finite_models": { + "coordinates_per_replica_family": 2, + "families": [ + "X", + "Y", + "H" + ], + "interleavings": { + "completed_boundaries": 24, + "distinct_final_matrices": 1, + "exact_squared_norm_checks": 384, + "sample_majorant": "1 + maximum calls completed in any one replica", + "sample_vectors": 16, + "schedules": [ + [ + 0, + 0, + 1, + 1 + ], + [ + 0, + 1, + 0, + 1 + ], + [ + 0, + 1, + 1, + 0 + ], + [ + 1, + 0, + 0, + 1 + ], + [ + 1, + 0, + 1, + 0 + ], + [ + 1, + 1, + 0, + 0 + ] + ] + }, + "negative_controls": [ + { + "foreign_source_in_helper": true, + "name": "missing_restoration" + }, + { + "foreign_helper_in_target": true, + "name": "missing_dirt_compensation" + }, + { + "cases": [ + { + "N": 2, + "endpoint_norm_squared": 1, + "first_prefix_norm_squared": 4 + }, + { + "N": 17, + "endpoint_norm_squared": 1, + "first_prefix_norm_squared": 289 + }, + { + "N": 1000000, + "endpoint_norm_squared": 1, + "first_prefix_norm_squared": 1000000000000 + } + ], + "name": "restored_endpoint_unbounded_prefix", + "parameterized_identity": "endpoint independent of N; first-prefix norm = N", + "required_hypothesis": "retain the local primitive-prefix cap" + }, + { + "global_l2_squared_before_and_after": 2, + "max_family_squared_after": "49/25", + "max_family_squared_before": "1", + "name": "unitary_mixes_families" + }, + { + "global_l2_squared_before_and_after": 2, + "max_family_squared_after": "49/25", + "max_family_squared_before": "1", + "name": "global_unitarity_is_not_max_family_contraction" + }, + { + "events_per_replica": 1, + "incorrect_independent_depth_upper_bound_squared": 4, + "individual_operator_norm_upper_bound": 2, + "input_max_family_squared": 1, + "name": "inter_replica_endpoint_mixing", + "output_max_family_squared": 9 + } + ], + "norm": "maximum over (replica, family) of that family's two-coordinate l2 norm", + "replicas": 2, + "scope": "exact finite models; not a native supplier or eight-replica replay", + "signed_dirty_helper_gadgets": { + "borrow_and_target_signs": [ + -1, + 1 + ], + "both_replica_directions": true, + "cases": 8, + "endpoint_matrix_equalities": "all inputs in the 12-dimensional model", + "residual": [ + [ + "3/5", + "-4/5" + ], + [ + "4/5", + "3/5" + ] + ] + }, + "status": "PASS" + }, + "prefix_bits": { + "inherited_arithmetic_margin": 4, + "inherited_input_conversion": 37, + "inherited_local": 101, + "old": 286, + "reduction": 126, + "replica_bound": 160, + "retained_payload": 512, + "schedule_sensitive_bound": 160 + }, + "schedule": { + "calls": 72, + "cross_replica_helper_roles": 28404, + "endpoint_norm": "maximum of individual streamed-family L2 norms, grouped by owner replica", + "global_growth_factors": 144, + "growth_factors_per_replica": [ + 18, + 18, + 18, + 18, + 18, + 18, + 18, + 18 + ], + "helper_roles": 35424, + "local_and_controller_prefix_bits": 119, + "scheduled_replica_events": 240, + "source_events_per_replica": 30, + "trace_sha256": "acca13940ffbf9beeb60fd0877bec0c36c89659ba8d82369aabd5c7bb0f92a08" + }, + "schedule_controls": [ + "duplicate_call", + "out_of_order_replica", + "changed_provider", + "doubled_bridge", + "cross_replica_bridge", + "missing_bridge", + "unknown_event", + "data_owner_in_other_replica", + "wrong_helper_replica", + "aliased_helper_family", + "helper_on_active_data", + "missing_local_allowance" + ], + "scope": "Conditional precision-accounting refinement only; no new kappa, cold supplier replay, physical realization proof or production integration.", + "status": "PASS_REPLICA_PREFIX_AUDIT" +} diff --git a/research/replica-prefix-audit/NOTICE.md b/research/replica-prefix-audit/NOTICE.md new file mode 100644 index 0000000000..93a58cd486 --- /dev/null +++ b/research/replica-prefix-audit/NOTICE.md @@ -0,0 +1,33 @@ +# Attribution and scope + +Contribution by Brody Arbon. Substantial OpenAI Codex assistance was used +for source inspection, mathematical derivation, implementation, testing, +writing and separate AI reviews. No independent human review or formal +proof-assistant certification is claimed. New material is Apache-2.0. + +The audited #626 owner repair is Chafik Boukhalfa / chafreaky's work, +using Jeremy Kothe / jeremykothe2's #622/#623 K-triangle construction and +dispatch. GamingPuzzled / Joel Pulikkan's owner-headroom lead, icekylinx's +controller/emitter/hosting and scalar accounting lineage, DreamingOfClouds' +cold helpers, Rohan Arun's #559 recurrence correction, eumemic's #543 bit +supplier and the cumulative community contributions remain credited. +The original repository's notices and contributor record are authoritative +for the full lineage and are unchanged by this package. + +Specific prior analytic credit: eumemic's #496 at +`00cf70efd6a8637531deafef698157ca83e249ee` already states the global +maximum-stream norm, whole-family right-translation bijections and +unitary-helper endpoint argument. This work adds individual replica +counters for #626; it does not originate that norm or cover argument. + +Concurrent #675 (Tekalign / tekuuu) checks owner-window boundaries and +bridge-omission scalar evidence. #696 (Sagar Thakrar), #734 (Chris Pagolu) +and #783 (Rohan Guliani) study/recount local scalar circuits and their +prefixes. Those are distinct from this global replica-norm accounting +argument; no code from those pending packages is imported. + +The triangle inequality, norm invariance under unitary maps and induction +on an interleaving are standard mathematical tools. No literature-priority +claim is made. The contribution is their explicit application to the +selected source schedule, including borrowed familywise unitary residuals, +with executable source bindings and adverse controls. diff --git a/research/replica-prefix-audit/OVERLAP.json b/research/replica-prefix-audit/OVERLAP.json new file mode 100644 index 0000000000..d335a994e1 --- /dev/null +++ b/research/replica-prefix-audit/OVERLAP.json @@ -0,0 +1,203 @@ +{ + "checked_utc": "2026-10-13T05:54:42.693479+00:00", + "open_pr_count": 621, + "page_counts": [ + 100, + 100, + 100, + 100, + 100, + 100, + 21, + 0 + ], + "highest_pr": 802, + "precise_overlap_hits": [ + { + "number": 681, + "title": "Consolidate six circuit PRs: 31.72% fewer bit ADDs and 22\u201325% fewer complex primitives", + "head": "e536f6fc8aad65adef8ac4682d13625598a5c3f9" + }, + { + "number": 742, + "title": "Research: shared target donors save 3,288 R420 XORs (no new kappa)", + "head": "6e7a5d271a123886dc7b54ca3180d0b9f9beda5a" + }, + { + "number": 708, + "title": "Research: save 114 R420 XORs by sharing restored decoder operands (no new kappa)", + "head": "2ec522a466ec448f148d4355dc43b51c0ef1e0b5" + }, + { + "number": 688, + "title": "Research: compose R420 circuits with 16,704 fewer hosted instructions (no new kappa)", + "head": "bb05c40c3e6319aa8c131b06a105e3648ac6c95b" + }, + { + "number": 473, + "title": "Conditional kappa 0.001467289440740487: rank-sector factory on 112 ports", + "head": "c26b3cc74d0203948f973a41d38340116c79dab8" + }, + { + "number": 525, + "title": "Kernel102 checkpoint: full cold reconstruction and exact fixed-word ceiling", + "head": "71acd0c35ee81de848316b3f2b4c3bd15b219c51" + }, + { + "number": 507, + "title": "\u03ba = 0.001363614743745701: partial-own factory with 84 kernel pivots", + "head": "8d4444cf8a16d500cbb94add6e4fa8bcfb9c7d5e" + }, + { + "number": 501, + "title": "Conditional \u03ba = 0.001343518018117309: retimed pooled whole-owner complex supply", + "head": "1dc056496fdbbc74073ed26d948a2dc235dbf356" + }, + { + "number": 496, + "title": "Conditional \u03ba = 0.001332077359286333: pooled whole-owner complex supply", + "head": "00cf70efd6a8637531deafef698157ca83e249ee" + }, + { + "number": 462, + "title": "Conditional \u03ba = 0.001274494971185576: four-replica whole bit hosting", + "head": "a63b25e65578816d78843c0e25131d9be7567cd2" + }, + { + "number": 320, + "title": "Conditional \u03ba = 7.69553898621543\u00b710\u207b\u2074: the full transcript stage stack on #315's p = 10 word, with a shared-donor closure kernel (+0.697% over #315)", + "head": "e912cbdd649fcbd292293c70511882b06266b276" + }, + { + "number": 284, + "title": "Conditional \u03ba = 7.26291692225845\u00b710\u207b\u2074: 91 collective response-kernel families on helpers untouched by #283, at its own cut (+0.0248% over #283)", + "head": "2c991a3ac400057059145c837e8b32bba9128346" + }, + { + "number": 280, + "title": "Conditional \u03ba = 0.000724189082265949: gen4 retiming, 440 early restorations and 60 dirty entrances", + "head": "f063aab8d6e514188e53db57218515df9cdd186e" + }, + { + "number": 227, + "title": "\u03ba = 6.947753951612e-4: independent native replay of coordinated source-gauge construction", + "head": "418bd6a80f3190d1998780a2fb7f66a073367de1" + } + ], + "related": [ + { + "number": 783, + "title": "Audit: independent recount confirms #696's 22\u201325% primitive saving (no new kappa)", + "head": "e3576811d416f91dc80b995ce4b8bc8a6144509e" + }, + { + "number": 734, + "title": "Research: prefix-bounded signed-Horner circuits for CK and JP8 (no new kappa)", + "head": "ba76ba3321d000c8996b0b254bcf0d7260e1bbb6" + }, + { + "number": 696, + "title": "Research: lower selected complex scalar primitives by 22\u201325% (no new kappa)", + "head": "5a3f983715027c4fd83f50bc9001d4b18463bed1" + }, + { + "number": 675, + "title": "Research audit: PR626 owner boundaries and bridge-omission blind spot", + "head": "f011d03633f0570257b653e7aa1e869b1b06d06a" + } + ], + "search_terms": [ + "replica.*prefix", + "global.*prefix", + "160 bit", + "286 to 160", + "replica.*norm" + ], + "assessment": "Matched contexts were reviewed. PR496 supplies the prior global norm proof, charging72 calls plus9 simultaneous bridges in its historical schedule. No overlapping selected PR626 replica-local286-to160 allowance refinement was identified in the refreshed metadata. Metadata review is not an exhaustive full-code novelty proof.", + "pre_handoff_refresh": { + "checked_utc": "2026-10-13T06:01:26.447699+00:00", + "method": "Most recently updated 100 open PRs after complete 621-PR scan", + "highest_pr": 809, + "newly_updated": [ + { + "number": 804, + "title": "Independent verification: integral-divisibility kernel replay and radix 81", + "head": "1f387e7090359165a0df046183eb8fa16c246d7d", + "updated_at": "2026-10-13T06:03:43Z" + }, + { + "number": 801, + "title": "Research: certified format ceilings for Eisenstein/Gaussian/Hurwitz E8 copy floors (no \u03ba claim)", + "head": "f0758653a5a1f72c3b59e58d6fe8d658db20b50b", + "updated_at": "2026-10-13T06:03:41Z" + }, + { + "number": 809, + "title": "Research circuit: lower historical dyadic center bill with one basis shear (no new kappa)", + "head": "66cabb478385fbaa1a8060123cd57545d703d84e", + "updated_at": "2026-10-13T06:03:28Z" + }, + { + "number": 808, + "title": "Tooling: pack cyclic routing states with identical exhaustive receipts", + "head": "b9c280c49d9c0c15f88c386286e6cd2a892efb67", + "updated_at": "2026-10-13T06:03:16Z" + }, + { + "number": 805, + "title": "Research: determinant-balanced cyclic leaves with exact dirty restoration (no new kappa)", + "head": "ef34bd5b32fcf2d5640dae90b5b8f28488738d5a", + "updated_at": "2026-10-13T06:02:58Z" + }, + { + "number": 807, + "title": "Research: restored CK helper pairs save 35,872 primitives per orientation (no new \u03ba)", + "head": "b1a5c533a22c2665600102d872f6a84e0664a70d", + "updated_at": "2026-10-13T06:02:09Z" + }, + { + "number": 806, + "title": "Audit #695: selected #626 provenance digest differences are timing and directory order, reproduced byte for byte", + "head": "4189f39ec022b7d1f8adb6c394f80b2c31a3f9c5", + "updated_at": "2026-10-13T06:01:58Z" + }, + { + "number": 673, + "title": "Research: dirty echo, verifier repair, and priced bit-sharing boundaries", + "head": "0b4f514c60d9bc7786415d7cbc24754f24d6dc3b", + "updated_at": "2026-10-13T05:59:25Z" + }, + { + "number": 803, + "title": "Research: degree-controlled cyclic inverse bound by root reflection (no new kappa)", + "head": "d213ac12d4a1ab8f717d942e844df318ceb395fb", + "updated_at": "2026-10-13T05:58:06Z" + }, + { + "number": 717, + "title": "Format limits part 2 (no \u03ba claim): erratum to #595, exact invoice prices, frontier-word censuses, decoder floors, spec requirements, centre and fragmentation walls", + "head": "4150829a2cb66b823f4282da98985959ee448a90", + "updated_at": "2026-10-13T05:56:43Z" + }, + { + "number": 802, + "title": "Audit: independent replay confirms #681's 1,484-operation raw factory saving (no new kappa)", + "head": "0957b70fc2ed1ac7592467e7a24d6d0788ff6758", + "updated_at": "2026-10-13T05:56:42Z" + } + ], + "assessment": "No additional replica/global-prefix accounting overlap identified in the refreshed title/body screen." + }, + "submission_refresh": { + "checked_utc": "2026-10-13T06:12:25Z", + "upstream_main": "7ee02b7c96d85f22b38d28bd7ed49bb8c1aeb261", + "current_selected_source_pr": 741, + "current_selected_source_head": "e516b1463606840a15f80aac1995d64ce0092e89", + "current_selected_kappa": "1661202643272239/1000000000000000000", + "pinned_inputs_unchanged_at_current_main": 17, + "input_comparison_method": "Individual remote Git blob IDs compared with base Git blobs, including exact gzip container bytes.", + "open_prs_screened": 100, + "highest_pr": 811, + "assessment": "No duplicate 286-to-160 replica global-prefix result in recent titles/bodies. #771 cover-order/invoice guards and #734 local signed-Horner bounds have distinct scopes. Audit remains pinned to historical #626; no transfer to #741 claimed." + } +} diff --git a/research/replica-prefix-audit/PROOF.md b/research/replica-prefix-audit/PROOF.md new file mode 100644 index 0000000000..9c1728018d --- /dev/null +++ b/research/replica-prefix-audit/PROOF.md @@ -0,0 +1,178 @@ +# A replica-local prefix bound with borrowed unitary residuals + +## Precise statement + +This statement concerns #626 at base +`66849e1475c930fd7732b1a0067ffee7e1e95f60`. "Selected" below refers to that +pinned baseline. No prefix estimate for the later upstream frontier follows. + +Assume the same normalized finite-family interfaces used by the selected +#626 global-prefix invoice. In particular: + +1. Each physical streamed family has a Hilbert norm. Its frame/chart + changes, phase corrections, residual endpoints and idle operations + are unitary **within that family**. Permutations of families within + a replica are also allowed. An arbitrary unitary that mixes families + is not covered by this assertion. +2. At a completed local invocation boundary, the active data families of + the invocation replica implement a normalized shear `Y += U X` or + `X -= U* Y`, with `U` unitary (a contraction would suffice). Every + borrowed helper has only its own familywise unitary residual endpoint; + no output in another family depends on that helper's initial dirt. + Private centres/work are cleared. A call is indivisible. +3. A bridge has coefficient +1 or -1 and operates on two pairs of + families of the same replica. All other completed controller events + preserve the maximum individual-family norm within each replica. +4. For any local invocation and arbitrary data/helper inputs, the + existing scalar/Horner envelope bounds each internal streamed-family + norm by `L` times the maximum input-family norm, for a fixed `L < 2^101`. The + inherited normalization/stream-conversion and arithmetic margins + remain 37 and 4 bits, respectively. + +Then the selected asynchronous controller has sufficient global-prefix +allowance **160 bits**, independent of which replica supplies a helper. +All-size compilation, common-label/mutable-basis realization, normalized +residuals, physical hosting, recursive precision, tape/exact recovery and +analytic transfer remain inherited. This statement does not establish +these assumptions anew. + +## Norm and endpoint induction + +For replica `r`, write + +``` +B_r = max { ||x_f||_2 : physical data/owner family f belongs to replica r }. +``` + +If a family is split across orthogonal cover classes, take the maximum +over the corresponding streamed-family instances as in the inherited +prefix argument. This is **not** the Euclidean norm of the concatenation +of every physical family. Thus no uncharged square root of the number of +families is inserted into the inherited 37-bit conversion. + +A data shear obeys `||Y + U X||_2 <= ||Y||_2 + ||X||_2 <= 2 B_r`. +The other direction and signs have the same bound. Its helper endpoints +are unitary within their actual owner families. They may change those +families' values, but they leave their individual norms unchanged. Hence +only the invocation replica needs a factor of two in its bound. + +Likewise, both components of a bridge are updated from the matching +components of another pair in the **same** replica. Each component obeys +the triangle inequality above, so one factor of two covers the bridge; +there is no extra factor for its two separate destinations. + +Let `a_r(t)` count completed local sweeps and bridges belonging to replica +`r` at boundary `t`, including the bridge currently being bounded after +its update. Induction gives + +``` +B_r(t) <= 2^a_r(t) B_initial, +max_r B_r(t) <= 2^max_r a_r(t) B_initial. +``` + +The induction does not commute physical calls, reorder helper borrows, or +assume helpers are clean. Interleaved familywise residual unitaries need +not commute with later shears. Their norm-one action is enough. It also +does not claim that 72 physically concurrent calls are legal: the +selected serialized schedule and whole-call hosting are retained. + +Every replica has nine local sweeps and nine bridges, so `a_r(t) <= 18`. +The old argument multiplied bounds for all replicas and charged 144 +factors. Taking the maximum of the eight independently maintained bounds +charges at most 18 factors. + +## Inside a borrowed-helper invocation + +At its start, every input/helper family, including a helper owned by a +different replica, is bounded by `2^max_r a_r B_initial`. Apply the +existing local prefix envelope to this **global maximum**. This gives +`2^(101+18) B_initial` as a conservative bound during the invocation. +The inherited whole-family charts are right-translation bijections: +each physical stream occurs once in a complete invocation's cover sweep. +That interface is needed to lift the vertex-local scalar/Horner receipt +to this bound; the receipt alone would not rule out repeated stream use. +It is unsafe to use just the active replica's own counter: a borrowed +helper may belong to a replica that has progressed further. + +Consequently the sufficient inherited-style allowance is + +``` +local scalar/Horner 101 +input stream conversion 37 +completed replica growth 18 +primitive arithmetic margin 4 + --- + 160 +``` + +Some other replica can already have completed all 18 factors while a +late invocation is active. We therefore retain 18 in this uniform bound. +Prefixes of bridge additions and atomic familywise unitary events obey +the same allowance. Prefixes inside their compiled realizations remain +covered only by the inherited primitive/compiler-prefix interface. +The final family translations and within-replica signed +exchanges preserve the same maximum norm. The existing 512-bit reserve +is unchanged, and no precision/tape constant is automatically reduced. + +## Binding to the retained construction + +The prior global maximum-stream norm argument is explicitly credited to +eumemic's [#496 proof at its pinned head](https://github.com/eumemic/integer-mult-bounds/blob/00cf70efd6a8637531deafef698157ca83e249ee/research/r489-pooled-whole-complex/PROOF.md). +It charges 72 local sweeps and nine simultaneous bridge sweeps in that +historical schedule, obtaining `20 + 37 + 72 + 9 + 4 = 142` bits without +using replica independence. This audit preserves its norm, whole-family +chart argument and normalized-helper interface. The additional step is +an individual replica counter for the selected asynchronous schedule, +whose old invoice separately charges 72 local and 72 bridge sweeps. +Neither the norm choice nor its inherited cover argument is claimed new. + +`SOURCES.json` identifies every file below by exact source bytes or full +decompressed gzip payload, at the stated base commit. + +- The retained `ROUND20-PARENT-TEMPLATE.json.gz` has local stage pairs + `0,0,0,1,1,2,2,3,3`, and nine bridges with unit signed coefficients. + In call `(stage, replica)`, all 224 data-owner families are + `896*replica + 224*pair + j`, `0 <= j < 224`. +- `prepare_supplier_base.py` preserves the recipe, first 30 source + schedule events and active data owners through supplier substitution. + `emit_allcold.py` expands source blocks into the selected plan's + one-replica interleaving. `audit_allcold.py` independently requires + the exact source projection `0..29` for each replica, indivisible local + calls and preserved active data owners. The selected template itself + is not in the committed receipt directory; source review and the + frozen receipts are inherited evidence, not a fresh template replay. +- `PLAN.json` selects 72 calls (64 JP8, 8 CK); every replica's projected + call sequence is stages `0..8`. `OWNERS.json.gz` contains 35,424 roles, + 28,404 of them cross-replica. Every call has 492 distinct helper + families disjoint from its active data families. Our checker verifies + these exact finite membership conditions, not all hosting geometry. +- `hpe_audit_local.py` and `hpe_audit_and_transport.py` check the + arbitrary-dirt scalar endpoint on every input column. That endpoint + restores helper coordinates in the scalar frame. The physical + interpretation is supplied separately by `hpe_adapters_local.py`: + a helper residual is normalized to a Fourier transform tensored with + identity, on its own physical family. It need not be physical identity. +- The selected invoice reports the largest local allowance as 101 bits + (JP8 backward), and the global allowance as 286. Both native program + orientations are semantically hash-bound to the consumed invoice. + We inherit the exact local arithmetic and frame/phase verification; + merely reading a PASS receipt is not a new replay of those obligations. + +## Adverse controls and limits + +The finite models test dirty helper restoration and unitary residuals +with exact rational arithmetic. Missing restoration or compensation +introduces cross-replica dependence. A rational rotation that mixes two +different families can increase their maximum norm, although it is +unitary for the concatenated Euclidean norm. Endpoint identity can hide +arbitrarily large intermediate excursions; this is why the 101-bit local +prefix certificate is still needed. These are counterexamples to weakened +interfaces, not counterexamples to the accepted #626 construction. + +Schedule mutations reject doubled or inter-replica bridges, omitted +events, changed dispatch, chronology errors and invalid family ownership. +Such finite tests support the argument and its source bindings; they do +not prove the complete multiplication theorem. This result improves an +overcharge in one conditional bound and leaves kappa unchanged. + +Brody Arbon, with substantial OpenAI Codex assistance. Apache-2.0. diff --git a/research/replica-prefix-audit/README.md b/research/replica-prefix-audit/README.md new file mode 100644 index 0000000000..e89b8ee48e --- /dev/null +++ b/research/replica-prefix-audit/README.md @@ -0,0 +1,93 @@ +# Replica-local global-prefix audit + +At the pinned base below, the then-selected #626 invoice uses the sufficient prefix estimate +`101 + 37 + 72 + 72 + 4 = 286` bits. Under the same normalized endpoint, +local scalar/Horner, and physical realization assumptions, the eight +interleaved replica controllers admit the sharper sufficient estimate +**`101 + 37 + 18 + 4 = 160` bits**. Each replica has nine local shears and +nine bridges. Borrowing a helper from another replica does not increase +that owner's norm at the completed invocation boundary: its physical +endpoint is a unitary transform within that family. + +This is a **mathematical audit / conditional precision-accounting +refinement**, with no new kappa. The 126-bit reduction is in a sufficient +estimate, not a measurement of the minimum necessary precision. The +production allowance remains 512 bits, and all production files are unchanged. +No runtime improvement, stronger multiplication bound, or complete theorem +formalization follows. + +Upstream adopted a newer frontier while this completed audit awaited a +writable fork. References to "selected" in this package mean #626 at the +pinned base, not the current upstream selection. The 160-bit estimate has +not been transported to the newer construction. + +## Reproduce + +From a checkout containing the source-pinned inputs, using Python 3.10+ +and only the standard library: + +```sh +python3 -B research/replica-prefix-audit/verify.py +``` + +Expected: + +```text +PASS_REPLICA_PREFIX_AUDIT calls=72 owner_roles=35424 prefix_bits=286->160 retained_payload=512 no_new_kappa +``` + +The default command is offline and writes nothing. It verifies all source +pins, compares its complete result with `EXPECTED.json`, and runs negative +controls. Checks remain enabled under `-I -O`. `--repo PATH` selects an +alternative input root. `--record NEW_PATH` writes a new receipt and refuses +to overwrite any existing file; it is an evidence-generation mode, not a +comparison with the committed expectation. + +## What is checked + +- All 72 selected calls and their provider/orientation/program bindings; + all 240 projected replica events; all nine local and nine bridge events + in each source controller. +- All 35,424 helper roles, including 28,404 cross-replica roles, for the + family membership and non-aliasing conditions used here. This is not a + new owner-window, orthogonal-chart or capacity audit. +- The retained source's 224 data-owner families in every call stay within + that call's replica. Existing source checks preserve these data owners + through supplier substitution and final hosting. +- Existing local scalar/Horner receipts and program hashes bind the + inherited 101-bit allowance. Their full native arithmetic, frames and + phases are not replayed by this command. +- Independent exact finite dirty-helper models and counterexamples test + the boundary/prefix distinction. These corroborate the written proof in + [PROOF.md](PROOF.md); they do not prove the all-size interfaces by enumeration. + +The selected generated `GLOBAL-TEMPLATE.json.gz` is not committed in the +review receipt directory. This audit explicitly uses the retained parent +template, selected plan and owners, pinned substitution/emitter/audit +source, and frozen selected receipts. It does **not** claim to have +regenerated the missing template or rerun the cold construction. The exact +dependency boundary is in the proof and [SOURCES.json](SOURCES.json). + +## Provenance and overlap + +Base: `66849e1475c930fd7732b1a0067ffee7e1e95f60`. +Selected #626 source: `660de893d27bb7abd1d5b01b1640207528a5c851`. +Construction #622 source: `f69477f4f6d3c7eb1f740b166881bffed4ffa9f6`. +The pinned baseline's kappa is `51110230636731/31250000000000000`. +All consumed files have exact byte or complete decompressed-payload hashes. + +This builds on eumemic's #496 global maximum-stream norm argument, +adding individual replica counters for the selected asynchronous schedule. +It credits #675's separate owner-boundary/scalar-omission audit and +#696/#734/#783's local primitive and prefix work. It does not depend on +their code. The present addition concerns the global norm allowance for +asynchronous complete calls, not local scalar lowering, owner allocation, +or reconstruction of the selected moment. See [CLAIM.md](CLAIM.md) for +the seed, candidate selection and bounded stopping rule, and +[VALIDATION.md](VALIDATION.md) for actual execution results. + +Contribution by **Brody Arbon**, with substantial **OpenAI Codex assistance** +in source inspection, derivation, implementation, tests, writing and review. +Separate Codex agents reviewed the proof and source dependencies; this is +not independent human peer review or proof-assistant verification. +Apache-2.0. See [NOTICE.md](NOTICE.md) for predecessor credit. diff --git a/research/replica-prefix-audit/SOURCES.json b/research/replica-prefix-audit/SOURCES.json new file mode 100644 index 0000000000..11bab179c4 --- /dev/null +++ b/research/replica-prefix-audit/SOURCES.json @@ -0,0 +1,103 @@ +{ + "base_commit": "66849e1475c930fd7732b1a0067ffee7e1e95f60", + "selected_source_pr": 626, + "selected_source_head": "660de893d27bb7abd1d5b01b1640207528a5c851", + "construction_source_pr": 622, + "construction_source_head": "f69477f4f6d3c7eb1f740b166881bffed4ffa9f6", + "selected_kappa": "51110230636731/31250000000000000", + "hash_policy": "Exact bytes for text; full decompressed payload for gzip, independent of compression metadata. No fields are omitted.", + "inputs": { + "parent": { + "path": "research/complex-k492-owner-repair/vendor/multicold/vendor/pr558/vendor/pr552/complex-global/vendor535/inputs/ROUND20-PARENT-TEMPLATE.json.gz", + "representation": "gzip-payload", + "sha256": "9bebafae2c7e21a8a134cc9f2d4709c075b1641abafc33825d116b2508253ceb" + }, + "plan": { + "path": "research/complex-k492-owner-repair/data/PLAN.json", + "representation": "bytes", + "sha256": "8c48ef6ce079916314126c5c3ff0003b32f24cf0fbfb2a033fc93e1e1949b5d5" + }, + "owners": { + "path": "research/complex-k492-owner-repair/data/OWNERS.json.gz", + "representation": "gzip-payload", + "sha256": "cacbaa6b27e0d612b77f2d6fed40eb99a6245f690eb771ffbf76655484866201" + }, + "invoice": { + "path": "research/community-k492-audit/pr626/replay/mixed-global/audit/PREFIX-AND-INVOICE.json", + "representation": "bytes", + "sha256": "367a73f744ea9b7dd6cca5fa3fda47175f560aa3d37e708c9fa1294dbd4b56eb" + }, + "prefix": { + "path": "research/community-k492-audit/pr626/replay/mixed-global/audit/GLOBAL-PREFIX.json", + "representation": "bytes", + "sha256": "7d1d55e8f3faa30b980599ba2d8a13c777b12831bc5b4cad03568968ee80aff9" + }, + "controller_receipt": { + "path": "research/community-k492-audit/pr626/replay/mixed-global/audit/ASYNC-AUDIT.json", + "representation": "bytes", + "sha256": "058a11d864d4d1fd13599146079fb6844ada27448060cca678495b9eff3aa58e" + }, + "emitter": { + "path": "research/complex-k492-owner-repair/code/emit_allcold.py", + "representation": "bytes", + "sha256": "fe26f10fe5d30ed407a37540a45ef94f44576dd241d09e19aef5db1efb072746" + }, + "controller_audit": { + "path": "research/complex-k492-owner-repair/code/audit_allcold.py", + "representation": "bytes", + "sha256": "cea021ae79658ca7ca4d07f1e1a70bdb4947afaf95b362114c11032c0fef889a" + }, + "invoice_code": { + "path": "research/complex-k492-owner-repair/code/invoice_allcold.py", + "representation": "bytes", + "sha256": "141bd2fd58bbfb5b8d0fc8f56f61c45586d5608a5af3487c6b883dd987f998ec" + }, + "prepare_parent": { + "path": "research/complex-k492-owner-repair/vendor/multicold/vendor/pr558/vendor/pr552/complex-global/vendor531/code/prepare_supplier_base.py", + "representation": "bytes", + "sha256": "f5eae94aca965d0008bc07cff8245ccb7509042ccad457d3bcb7d51c1e9409f0" + }, + "local_audit": { + "path": "research/complex-k492-owner-repair/code/hpe_audit_local.py", + "representation": "bytes", + "sha256": "6bd9a1e279c9c9e4f3767d9f82e537b559292906feb2ddab02f380fb6523a810" + }, + "local_transport": { + "path": "research/complex-k492-owner-repair/code/hpe_audit_and_transport.py", + "representation": "bytes", + "sha256": "c9a05ff291016b870b4fc925b317abd9c3a604c73ffc8920dfdbbeb475e20aa3" + }, + "local_adapters": { + "path": "research/complex-k492-owner-repair/code/hpe_adapters_local.py", + "representation": "bytes", + "sha256": "eb0b5c6c7161e18dc22168da3211448d321586edd15bcfb4b4741174d36993cf" + }, + "ck_program": { + "path": "research/community-k492-audit/pr622/replay/mixed-global/base/providers/ck/LOCAL-PROGRAMS.json.gz", + "representation": "gzip-payload", + "sha256": "854f17274092263dc25e60367f4cd0d29f60a8446becd17cc1883ebed7a97900" + }, + "ck_replay": { + "path": "research/community-k492-audit/pr622/replay/mixed-global/base/providers/ck/INDEPENDENT-LOCAL-REPLAY.json", + "representation": "bytes", + "sha256": "ecefb9e661301d8081522be68bbe6640e175c011eb1177f643383d193c6fb2f0" + }, + "jp8_program": { + "path": "research/community-k492-audit/pr622/replay/mixed-global/base/providers/jp8/LOCAL-PROGRAMS.json.gz", + "representation": "gzip-payload", + "sha256": "efe45ce7fb025a6f53cc9eb54e951ac2211a5ed927e689a049e4f68ca680654b" + }, + "jp8_replay": { + "path": "research/community-k492-audit/pr622/replay/mixed-global/base/providers/jp8/INDEPENDENT-LOCAL-REPLAY.json", + "representation": "bytes", + "sha256": "cb2f99ed351925dd35434b73de16f4085884fe81a35a69e1c7ce2d5e96cb975b" + } + }, + "reviewed_predecessor": { + "pr": 496, + "head": "00cf70efd6a8637531deafef698157ca83e249ee", + "url": "https://github.com/eumemic/integer-mult-bounds/blob/00cf70efd6a8637531deafef698157ca83e249ee/research/r489-pooled-whole-complex/PROOF.md", + "sha256": "144f1bf6952b3e31e99cf372a2cae9a13f96c9988808fe8a57ec70b09ee2007c", + "role": "Prior global maximum-stream norm argument; attribution/reference only, not a runtime input." + } +} diff --git a/research/replica-prefix-audit/VALIDATION.md b/research/replica-prefix-audit/VALIDATION.md new file mode 100644 index 0000000000..565aaa49e5 --- /dev/null +++ b/research/replica-prefix-audit/VALIDATION.md @@ -0,0 +1,51 @@ +# Validation record + +Local environment: Windows, CPython 3.10.6, standard library only. +Base: `66849e1475c930fd7732b1a0067ffee7e1e95f60`. + +Completed commands: + +```sh +python -B research/replica-prefix-audit/verify.py +python -I -O -B research/replica-prefix-audit/verify.py +python -B research/replica-prefix-audit/test_package.py +python -B scripts/verify_selected_result.py +git diff --check +``` + +The scoped verifier prints `PASS_REPLICA_PREFIX_AUDIT`; normal and +isolated optimized execution agree with the complete `EXPECTED.json`. +All 13 byte-pinned text inputs were also compared with the base commit's +Git blobs and agree byte for byte, including line endings. +The receipt records 72 calls, 240 replica events, 35,424 helper roles, +12 rejected schedule/ownership mutations, eight exact signed dirty-helper +gadgets, 24 completed boundaries in six interleavings, 384 exact norm +sample comparisons, and six mathematical adverse controls. + +All **five package tests pass**: minimal relocation to a path containing +spaces under isolated optimized Python; source byte corruption rejection; +expected-receipt corruption rejection; acceptance of an equivalent gzip +payload repackaged with different compression/header settings; and +refusal to overwrite an existing receipt. The package tests took about +50 seconds on this machine. This is not a performance benchmark. + +The selected-record integrity check at the pinned base passed with unchanged +`51110230636731/31250000000000000`. The initial verification refresh still +pointed to that base; upstream adopted a newer frontier before publication. +This audit and its selected-record check concern the original #626 baseline. +Only this new research directory is added; +`upstream/`, production generators and the selected frontier are unchanged. + +Separate Codex agents inspected the mathematical and source dependencies. +Review corrections explicitly distinguish scalar restoration from physical +unitary residuals, forbid uncharged cross-family mixing, handle the zero +input in the local bound, and retain compiler-prefix and chart-bijection +assumptions. The finite model was corrected before final validation to +use a separate norm for every `(replica, family)`, matching the proof. + +The full repository-wide `make verify`, selected supplier cold rebuild, +47 outer inequalities, Lean, a second interpreter/platform and remote +CI were **not run** for this isolated research addition. Frozen source +receipts are inherited evidence, not fresh execution. All full-size +compiler/hosting/normalization/precision/tape/analytic obligations remain +conditional. No human peer review or full theorem formalization is claimed. diff --git a/research/replica-prefix-audit/model_checks.py b/research/replica-prefix-audit/model_checks.py new file mode 100644 index 0000000000..12f47aab41 --- /dev/null +++ b/research/replica-prefix-audit/model_checks.py @@ -0,0 +1,338 @@ +"""Exact finite controls for the replica-prefix lemma; no supplier replay. + +The positive model has two replicas, three register families (X, Y, H), +and two rational coordinates per replica/family. A call shears Y by X in +one replica while borrowing arbitrary dirty H in the other replica. After +restoring H, it applies a non-scalar rational orthogonal residual to H. +Each (replica, family) has its own two-coordinate l2 norm; the ambient +norm is the maximum over all six individual family norms. + +Matrix equalities below hold for every input of this finite model. The +additional norm examples and negative controls support the written lemma; +they neither establish its dimension-independent proof nor replay any +native supplier, the eight-replica source schedule, or the full algorithm. +Only the Python 3.10+ standard library is used. Checks survive python -O. +License: Apache-2.0, following the repository license. This contribution +was developed with substantial AI assistance from OpenAI Codex. +""" + +from __future__ import annotations + +from fractions import Fraction as Q +from itertools import combinations +import json + + +Matrix = tuple[tuple[Q, ...], ...] +Vector = tuple[Q, ...] +REPLICAS = 2 +FAMILIES = ("X", "Y", "H") +WIDTH = 2 +DIMENSION = REPLICAS * len(FAMILIES) * WIDTH +ROTATION: Matrix = ((Q(3, 5), Q(-4, 5)), (Q(4, 5), Q(3, 5))) + + +def require(condition: bool, message: str) -> None: + if not condition: + raise RuntimeError(message) + + +def identity(n: int) -> Matrix: + return tuple(tuple(Q(i == j) for j in range(n)) for i in range(n)) + + +def transpose(a: Matrix) -> Matrix: + return tuple(zip(*a)) + + +def multiply(a: Matrix, b: Matrix) -> Matrix: + return tuple(tuple(sum((x * y for x, y in zip(row, col)), Q(0)) + for col in transpose(b)) for row in a) + + +def apply(a: Matrix, v: Vector) -> Vector: + return tuple(sum((x * y for x, y in zip(row, v)), Q(0)) for row in a) + + +def index(replica: int, family: str, coordinate: int) -> int: + return (replica * len(FAMILIES) + FAMILIES.index(family)) * WIDTH + coordinate + + +def owner(row: int) -> int: + return row // (len(FAMILIES) * WIDTH) + + +def add_family(a: Matrix, dst: tuple[int, str], src: tuple[int, str], + scale: Q) -> Matrix: + rows = list(a) + for c in range(WIDTH): + d, s = index(*dst, c), index(*src, c) + rows[d] = tuple(x + scale * y for x, y in zip(a[d], a[s])) + return tuple(rows) + + +def rotate_helper(a: Matrix, replica: int) -> Matrix: + rows = list(a) + old = tuple(a[index(replica, "H", c)] for c in range(WIDTH)) + new = multiply(ROTATION, old) + for c in range(WIDTH): + rows[index(replica, "H", c)] = new[c] + return tuple(rows) + + +def borrow(a: Matrix, active: int, helper: int, source_scale: Q = Q(1), + target_scale: Q = Q(1), *, restore: bool = True, + compensate: bool = True) -> tuple[Matrix, ...]: + """h+=s*x; y+=t*h; h-=s*x; y-=t*h; then h:=U*h. + + Return each stage, including the residual. Omissions are exposed only + for negative controls. No assumption that initial h is zero is made. + """ + require(active != helper, "positive model must borrow across replicas") + x, y, h = (active, "X"), (active, "Y"), (helper, "H") + stages = [] + a = add_family(a, h, x, source_scale) + stages.append(a) + a = add_family(a, y, h, target_scale) + stages.append(a) + if restore: + a = add_family(a, h, x, -source_scale) + stages.append(a) + if compensate: + a = add_family(a, y, h, -target_scale) + stages.append(a) + stages.append(rotate_helper(a, helper)) + return tuple(stages) + + +def endpoint(active: int, helper: int, scale: Q) -> Matrix: + a = add_family(identity(DIMENSION), (active, "Y"), (active, "X"), scale) + return rotate_helper(a, helper) + + +def replica_diagonal(a: Matrix) -> bool: + return all(value == 0 or owner(i) == owner(j) + for i, row in enumerate(a) for j, value in enumerate(row)) + + +def family_norm_squared(v: Vector) -> dict[tuple[int, str], Q]: + return {(r, f): sum((v[index(r, f, c)] ** 2 for c in range(WIDTH)), Q(0)) + for r in range(REPLICAS) for f in FAMILIES} + + +def max_family_norm_squared(v: Vector) -> Q: + return max(family_norm_squared(v).values()) + + +def vector(entries: dict[tuple[int, str, int], Q | int]) -> Vector: + result = [Q(0)] * DIMENSION + for coordinate, value in entries.items(): + result[index(*coordinate)] = Q(value) + return tuple(result) + + +def signed_gadgets() -> dict[str, object]: + require(multiply(transpose(ROTATION), ROTATION) == identity(2), + "helper residual must be exactly orthogonal") + require(ROTATION[0][1] != 0 and ROTATION[1][0] != 0, + "helper residual must not be a scalar identity") + cases = 0 + for active in range(REPLICAS): + helper = 1 - active + for s in (-1, 1): + for t in (-1, 1): + stages = borrow(identity(DIMENSION), active, helper, Q(s), Q(t)) + require(stages[-1] == endpoint(active, helper, Q(s * t)), + "signed gadget endpoint differs from local shear plus residual") + require(replica_diagonal(stages[-1]), + "completed gadget leaks between replicas") + require(not replica_diagonal(stages[0]), + "model did not exercise a cross-replica internal prefix") + for c in range(WIDTH): + h = index(helper, "H", c) + require(stages[2][h] == identity(DIMENSION)[h], + "helper was not restored before compensation and residual") + cases += 1 + return {"cases": cases, "both_replica_directions": True, + "borrow_and_target_signs": [-1, 1], + "residual": [[str(x) for x in row] for row in ROTATION], + "endpoint_matrix_equalities": "all inputs in the 12-dimensional model"} + + +def interleavings() -> dict[str, object]: + """All six shuffles of two calls in each of two replicas.""" + samples = list(identity(DIMENSION)) + samples += [tuple(Q(1) for _ in range(DIMENSION)), + tuple(Q((-1) ** i) for i in range(DIMENSION)), + tuple(Q(i - 5, 3) for i in range(DIMENSION)), + vector({(0, "H", 0): 7, (0, "H", 1): -2, + (1, "H", 0): -3, (1, "H", 1): 5})] + signs = ((1, 1), (-1, 1)) + final_matrices = set() + schedules = [] + boundaries = 0 + norm_checks = 0 + for zero_positions in combinations(range(4), 2): + schedule = tuple(0 if p in zero_positions else 1 for p in range(4)) + counts, coefficients = [0, 0], [0, 0] + actual = expected = identity(DIMENSION) + for active in schedule: + helper = 1 - active + sign = signs[active][counts[active]] + actual = borrow(actual, active, helper, Q(sign))[-1] + expected = multiply(endpoint(active, helper, Q(sign)), expected) + counts[active] += 1 + coefficients[active] += sign + require(actual == expected and replica_diagonal(actual), + "interleaved completed boundary is not replica diagonal") + # Check the closed form independently of endpoint composition. + for r in range(REPLICAS): + for c in range(WIDTH): + y = index(r, "Y", c) + row = list(identity(DIMENSION)[y]) + row[index(r, "X", c)] = Q(coefficients[r]) + require(actual[y] == tuple(row), "wrong replica-local shear sum") + for sample in samples: + out = apply(actual, sample) + initial_norms = family_norm_squared(sample) + output_norms = family_norm_squared(out) + for r in range(REPLICAS): + require(output_norms[r, "H"] == initial_norms[r, "H"], + "helper rotation changed its owner's individual family l2 norm") + require(output_norms[r, "X"] == initial_norms[r, "X"], + "replica source family changed") + cap = Q(1 + max(counts)) + require(max_family_norm_squared(out) <= cap ** 2 * max(initial_norms.values()), + "finite completed-boundary max-depth majorant failed") + norm_checks += 1 + boundaries += 1 + schedules.append(list(schedule)) + final_matrices.add(actual) + require(len(final_matrices) == 1, "shuffle changed the completed endpoint") + return {"schedules": schedules, "completed_boundaries": boundaries, + "sample_vectors": len(samples), "exact_squared_norm_checks": norm_checks, + "sample_majorant": "1 + maximum calls completed in any one replica", + "distinct_final_matrices": len(final_matrices)} + + +def omission_controls() -> list[dict[str, object]]: + clean = endpoint(0, 1, Q(1)) + unrestored = borrow(identity(DIMENSION), 0, 1, restore=False)[-1] + require(unrestored != clean and not replica_diagonal(unrestored), + "missing-restoration control was not rejected") + witness = vector({(0, "X", 0): 1}) + output = apply(unrestored, witness) + require(family_norm_squared(output)[1, "H"] == 1, + "missing-restoration witness did not retain foreign source data") + uncompensated = borrow(identity(DIMENSION), 0, 1, compensate=False)[-1] + require(uncompensated != clean and not replica_diagonal(uncompensated), + "missing-dirt-compensation control was not rejected") + dirty = vector({(1, "H", 0): 1}) + require(apply(uncompensated, dirty)[index(0, "Y", 0)] == 1, + "dirty helper witness did not contaminate target") + return [{"name": "missing_restoration", "foreign_source_in_helper": True}, + {"name": "missing_dirt_compensation", "foreign_helper_in_target": True}] + + +def unbounded_prefix_control() -> dict[str, object]: + # h+=N*x; y+=h/N; h-=N*x; y-=h/N has the SAME endpoint + # for every nonzero N, but its first prefix sends (x,h)=(1,0) + # to (1,N). Restoration is therefore insufficient without a local cap. + witness = vector({(0, "X", 0): 1}) + cases = [] + for n in (2, 17, 1_000_000): + stages = borrow(identity(DIMENSION), 0, 1, Q(n), Q(1, n)) + require(stages[-1] == endpoint(0, 1, Q(1)), + "scaled borrowing endpoint depends on internal amplification") + prefix_squared = max_family_norm_squared(apply(stages[0], witness)) + endpoint_squared = max_family_norm_squared(apply(stages[-1], witness)) + require(prefix_squared == n * n and endpoint_squared == 1, + "unbounded-prefix witness has incorrect exact norms") + cases.append({"N": n, "first_prefix_norm_squared": n * n, + "endpoint_norm_squared": 1}) + return {"name": "restored_endpoint_unbounded_prefix", "cases": cases, + "parameterized_identity": "endpoint independent of N; first-prefix norm = N", + "required_hypothesis": "retain the local primitive-prefix cap"} + + +def rotate_coordinates(a: Matrix, first: int, second: int) -> Matrix: + rows = list(a) + rows[first], rows[second] = multiply(ROTATION, (a[first], a[second])) + return tuple(rows) + + +def unitary_controls() -> list[dict[str, object]]: + result = [] + # Choosing inputs (1,-1) turns the first row into 7/5. + for second_replica, name in ((0, "unitary_mixes_families"), + (1, "global_unitarity_is_not_max_family_contraction")): + first = index(0, "X", 0) + second = index(second_replica, "Y", 0) + a = rotate_coordinates(identity(DIMENSION), first, second) + v = vector({(0, "X", 0): 1, (second_replica, "Y", 0): -1}) + out = apply(a, v) + require(multiply(transpose(a), a) == identity(DIMENSION), + "unitarity negative control was not exactly unitary") + require(sum(x * x for x in out) == sum(x * x for x in v) == 2, + "global l2 norm was not preserved") + require(max_family_norm_squared(v) == 1 and max_family_norm_squared(out) == Q(49, 25), + "unitary mixing failed to amplify the max-family norm") + require(replica_diagonal(a) == (second_replica == 0), + "unitary control uses the wrong replica support") + result.append({"name": name, "global_l2_squared_before_and_after": 2, + "max_family_squared_before": "1", + "max_family_squared_after": "49/25"}) + return result + + +def inter_replica_endpoint_control() -> dict[str, object]: + # One scalar family per replica, two replicas. Each event has max-family + # operator norm 2 (the maximum absolute row sum). With one event per replica, + # an invalid replica-independent argument would give cap 2 overall. + # The events actually mix replicas and compose to exceed that cap. + first: Matrix = ((Q(1), Q(1)), (Q(0), Q(1))) + second: Matrix = ((Q(1), Q(0)), (Q(1), Q(1))) + for a in (first, second): + require(max(sum(abs(x) for x in row) for row in a) == 2, + "individual event max-family operator cap failed") + total = multiply(second, first) + out = apply(total, (Q(1), Q(1))) + require(total == ((Q(1), Q(1)), (Q(1), Q(2))), + "wrong mixing-endpoint composition") + require(max(x * x for x in out) == 9 > 4, + "inter-replica mixing did not refute the independent-depth cap") + return {"name": "inter_replica_endpoint_mixing", "events_per_replica": 1, + "individual_operator_norm_upper_bound": 2, + "input_max_family_squared": 1, "output_max_family_squared": 9, + "incorrect_independent_depth_upper_bound_squared": 4} + + +def run_checks() -> dict[str, object]: + """Return a deterministic, JSON-serializable receipt or raise on failure.""" + signed = signed_gadgets() + shuffled = interleavings() + controls = omission_controls() + controls.append(unbounded_prefix_control()) + controls.extend(unitary_controls()) + controls.append(inter_replica_endpoint_control()) + receipt: dict[str, object] = { + "status": "PASS", + "scope": "exact finite models; not a native supplier or eight-replica replay", + "replicas": REPLICAS, "families": list(FAMILIES), + "coordinates_per_replica_family": WIDTH, + "norm": "maximum over (replica, family) of that family's two-coordinate l2 norm", + "signed_dirty_helper_gadgets": signed, + "interleavings": shuffled, + "negative_controls": controls, + } + # Check this interface as well; callers can safely serialize the receipt. + json.dumps(receipt, sort_keys=True) + return receipt + + +if __name__ == "__main__": + receipt = run_checks() + print("replica-prefix model checks: PASS " + f"({receipt['signed_dirty_helper_gadgets']['cases']} signed gadgets, " + f"{receipt['interleavings']['completed_boundaries']} completed boundaries, " + f"{len(receipt['negative_controls'])} negative controls)") diff --git a/research/replica-prefix-audit/test_package.py b/research/replica-prefix-audit/test_package.py new file mode 100644 index 0000000000..774ee895d0 --- /dev/null +++ b/research/replica-prefix-audit/test_package.py @@ -0,0 +1,94 @@ +"""Receipt, source-corruption and relocation controls for the scoped audit. + +Brody Arbon, with substantial OpenAI Codex assistance. Apache-2.0. +""" +import gzip +import json +from pathlib import Path +import shutil +import subprocess +import sys +import tempfile +import unittest + +HERE = Path(__file__).resolve().parent +ROOT = HERE.parents[1] + + +class PackageControls(unittest.TestCase): + @classmethod + def setUpClass(cls): + cls.tmp = tempfile.TemporaryDirectory(prefix="replica-prefix-", dir=ROOT.parent) + cls.root = Path(cls.tmp.name) / "minimal checkout with spaces" + cls.package = cls.root / "research" / HERE.name + cls.package.mkdir(parents=True) + for path in HERE.iterdir(): + if path.is_file(): + shutil.copy2(path, cls.package / path.name) + manifest = json.loads((HERE / "SOURCES.json").read_bytes()) + cls.inputs = manifest["inputs"] + for entry in cls.inputs.values(): + destination = cls.root / entry["path"] + destination.parent.mkdir(parents=True, exist_ok=True) + shutil.copy2(ROOT / entry["path"], destination) + + @classmethod + def tearDownClass(cls): + cls.tmp.cleanup() + + def run_audit(self, *extra): + return subprocess.run([sys.executable, "-I", "-O", "-B", + str(self.package / "verify.py"), *map(str, extra)], + cwd=ROOT.parent, capture_output=True, text=True, timeout=120) + + def test_1_relocated_isolated_optimized(self): + result = self.run_audit() + self.assertEqual(result.returncode, 0, result.stderr) + self.assertIn("prefix_bits=286->160", result.stdout) + + def test_2_source_corruption(self): + source = self.root / self.inputs["plan"]["path"] + original = source.read_bytes() + try: + source.write_bytes(original + b"\n") + result = self.run_audit() + self.assertNotEqual(result.returncode, 0) + self.assertIn("source pin: plan", result.stderr) + finally: + source.write_bytes(original) + + def test_3_changed_expected_receipt(self): + source = self.package / "EXPECTED.json" + original = source.read_bytes() + try: + modified = json.loads(original) + modified["prefix_bits"]["replica_bound"] = 159 + source.write_text(json.dumps(modified), encoding="utf-8") + result = self.run_audit() + self.assertNotEqual(result.returncode, 0) + self.assertIn("expected receipt mismatch", result.stderr) + finally: + source.write_bytes(original) + + def test_4_gzip_repackaging(self): + source = self.root / self.inputs["owners"]["path"] + original = source.read_bytes() + try: + source.write_bytes(gzip.compress(gzip.decompress(original), compresslevel=1, mtime=1234)) + self.assertNotEqual(source.read_bytes(), original) + result = self.run_audit() + self.assertEqual(result.returncode, 0, result.stderr) + finally: + source.write_bytes(original) + + def test_5_no_receipt_overwrite(self): + target = self.root / "existing receipt.json" + target.write_bytes(b"keep this exact content\n") + result = self.run_audit("--record", target) + self.assertNotEqual(result.returncode, 0) + self.assertIn("FileExistsError", result.stderr) + self.assertEqual(target.read_bytes(), b"keep this exact content\n") + + +if __name__ == "__main__": + unittest.main(verbosity=2) diff --git a/research/replica-prefix-audit/verify.py b/research/replica-prefix-audit/verify.py new file mode 100644 index 0000000000..90958638cb --- /dev/null +++ b/research/replica-prefix-audit/verify.py @@ -0,0 +1,239 @@ +"""Scoped PR626 replica-prefix audit; Python 3.10+, standard library only. + +The native supplier and physical realization assumptions remain inherited. +Prepared for Brody Arbon with substantial OpenAI Codex assistance; Apache-2.0. +""" +from collections import Counter +from copy import deepcopy +from fractions import Fraction +import argparse +import gzip +import hashlib +import importlib.util +import json +from pathlib import Path + +HERE = Path(__file__).resolve().parent +ROOT = HERE.parents[1] + + +def require(condition, message): + if not condition: + raise ValueError(message) + + +def digest(data): + return hashlib.sha256(data).hexdigest() + + +def canonical(value): + return json.dumps(value, sort_keys=True, separators=(",", ":")).encode() + + +def read_sources(root): + manifest = json.loads((HERE / "SOURCES.json").read_bytes()) + sources = {} + for label, entry in manifest["inputs"].items(): + path = root / entry["path"] + raw = path.read_bytes() + data = gzip.decompress(raw) if entry["representation"] == "gzip-payload" else raw + require(digest(data) == entry["sha256"], "source pin: " + label) + if entry["path"].endswith((".json", ".json.gz")): + sources[label] = json.loads(data) + return manifest, sources + + +def schedule_audit(parent, plan, invoice, owners): + """Reconstruct just source-event identities and norm-factor counts.""" + order = plan["order"] + require(len(order) == 72, "72 calls") + require(all(isinstance(x, list) and len(x) == 2 and + all(type(v) is int for v in x) and + 0 <= x[0] < 9 and 0 <= x[1] < 8 for x in order), "call domain") + require(len(set(map(tuple, order))) == 72, "call uniqueness") + for replica in range(8): + require([s for s, r in order if r == replica] == list(range(9)), "replica chronology") + calls = plan["provider_calls"] + require(len(calls) == len(invoice["selected_calls"]) == 72, "dispatch size") + for time, ((stage, replica), call, charged) in enumerate(zip(order, calls, invoice["selected_calls"])): + require((call["time"], call["stage"], call["replica"]) == (time, stage, replica), "dispatch order") + require((charged["stage"], charged["replica"]) == (stage, replica), "invoice order") + require(call["provider"] == charged["provider_id"], "provider binding") + require(call["orientation"] == charged["orientation"] == + ("backward" if stage % 2 else "forward"), "orientation") + require(call["local_program_sha256"] == charged["program_sha256"], "program binding") + + source = parent["execution_schedule"] + require(len(source) == 32, "source schedule size") + require([e["kind"] for e in source[-2:]] == + ["bank_padding_cover_sweep", "translate_every_live_family"], "global suffix") + blocks, stage = {}, None + kinds = {"local_cover_sweep", "bridge", "idle_cover_sweep", "terminal_Y_translations", "terminal"} + for position, event in enumerate(source[:-2]): + require(event["kind"] in kinds, "unknown event") + if event["kind"] == "local_cover_sweep": + stage = event["stage"] + require(stage not in blocks, "duplicate local stage") + require(event["replicas"] == list(range(8)), "source replicas") + blocks[stage] = [] + require(stage is not None, "event before first call") + if event["kind"] == "bridge": + require(type(event["coefficient"]) is int and abs(event["coefficient"]) == 1, + "bridge norm factor") + require(all(type(event[k]) is int and 0 <= event[k] < 4 for k in ("src", "dst")) + and event["src"] != event["dst"], "bridge family domain") + require("source_replica" not in event and "target_replica" not in event, + "cross-replica bridge") + blocks[stage].append((position, event)) + require(set(blocks) == set(range(9)), "nine local stages") + require(Counter(e["kind"] for e in source[:-2])["bridge"] == 9, "nine bridges") + + # Explicit disjoint streamed data families in the retained source controller. + expected_pairs = [0, 0, 0, 1, 1, 2, 2, 3, 3] + require(len(parent["calls"]) == 72, "parent calls") + for call in parent["calls"]: + s, r = call["stage"], call["replica"] + require(call["pair"] == expected_pairs[s], "source pair") + require(call["owners"][:224] == + [[896 * r + 224 * expected_pairs[s] + j, [1, s, j % 112]] for j in range(224)], + "active data owners") + + # This checks family ownership, not geometry, windows or residual unitarity. + roles, cross = set(), 0 + per_call_families = {} + require(len(owners) == 72 * 492, "helper role count") + for row in owners: + s, r, h, f, owner = (row[k] for k in ("stage", "replica", "helper", "family", "owner_replica")) + require(all(type(x) is int for x in (s, r, h, f, owner)), "integer owner") + require(0 <= s < 9 and 0 <= r < 8 and 0 <= h < 492 and 0 <= f < 7168, + "helper domain") + require(owner == f // 896, "owner replica") + require((s, r, h) not in roles, "duplicate helper") + roles.add((s, r, h)) + families = per_call_families.setdefault((s, r), set()) + require(f not in families, "helper family alias") + require(not (896 * r + 224 * expected_pairs[s] <= f < + 896 * r + 224 * expected_pairs[s] + 224), "helper on active data") + families.add(f) + cross += owner != r + + factors, counters, projection = [0] * 8, Counter(), [[] for _ in range(8)] + trace, prefix_max = [], 0 + for time, ((s, r), call) in enumerate(zip(order, calls)): + localbits = invoice["providers"][call["provider"]]["local"][call["orientation"]]["prefix_bits"] + require(type(localbits) is int and 0 < localbits <= 101, "local prefix bits") + for position, event in blocks[s]: + kind = event["kind"] + projection[r].append(position) + # A local prefix may read restored/unitarily transformed helpers from + # any owner replica. Thus use the maximum over ALL owner bounds. + if kind == "local_cover_sweep": + prefix_max = max(prefix_max, localbits + max(factors)) + if kind in ("local_cover_sweep", "bridge"): + factors[r] += 1 + counters[kind] += 1 + prefix_max = max(prefix_max, max(factors)) + trace.append([time, s, r, position, list(factors)]) + require(all(p == list(range(30)) for p in projection), "complete source projection") + require(factors == [18] * 8, "per-replica growth count") + require(counters == {"local_cover_sweep": 72, "bridge": 72}, "global growth count") + require(cross == 28404, "selected cross-replica roles") + return { + "calls": 72, "source_events_per_replica": 30, "scheduled_replica_events": len(trace), + "helper_roles": len(roles), "cross_replica_helper_roles": cross, + "growth_factors_per_replica": factors, "global_growth_factors": sum(factors), + "local_and_controller_prefix_bits": prefix_max, + "trace_sha256": digest(canonical(trace)), + "endpoint_norm": "maximum of individual streamed-family L2 norms, grouped by owner replica", + } + + +def controls(sources): + failures = [] + def reject(name, which, change): + copied = {k: deepcopy(sources[k]) for k in ("parent", "plan", "invoice", "owners")} + change(copied[which]) + try: + schedule_audit(**copied) + except ValueError: + failures.append(name) + else: + raise ValueError("control accepted: " + name) + reject("duplicate_call", "plan", lambda p: p["order"].__setitem__(1, p["order"][0])) + reject("out_of_order_replica", "plan", lambda p: p["order"].__setitem__(0, [1, 0])) + reject("changed_provider", "invoice", lambda p: p["selected_calls"][0].__setitem__("provider_id", "jp8")) + reject("doubled_bridge", "parent", lambda p: p["execution_schedule"][3].__setitem__("coefficient", 2)) + reject("cross_replica_bridge", "parent", lambda p: p["execution_schedule"][3].__setitem__("source_replica", 1)) + reject("missing_bridge", "parent", lambda p: p["execution_schedule"][3].__setitem__("kind", "terminal")) + reject("unknown_event", "parent", lambda p: p["execution_schedule"][2].__setitem__("kind", "unpriced_map")) + reject("data_owner_in_other_replica", "parent", lambda p: p["calls"][0]["owners"][0].__setitem__(0, 896)) + reject("wrong_helper_replica", "owners", lambda p: p[0].__setitem__("owner_replica", (p[0]["owner_replica"] + 1) % 8)) + reject("aliased_helper_family", "owners", lambda p: p[1].update(family=p[0]["family"], owner_replica=p[0]["owner_replica"])) + reject("helper_on_active_data", "owners", lambda p: p[0].update(family=0, owner_replica=0)) + reject("missing_local_allowance", "invoice", lambda p: p["providers"]["ck"]["local"]["forward"].__setitem__("prefix_bits", 0)) + return failures + + +def run(root): + manifest, sources = read_sources(root) + invoice, prefix = sources["invoice"], sources["prefix"] + require(invoice["status"] == "PASS_INDEPENDENT_MIXED_ASYNC_SCALAR_PREFIX_AND_FINITE_INVOICE", "invoice status") + require(prefix["status"] == "PASS_MIXED_ASYNC_GLOBAL_PREFIX", "prefix status") + require(invoice["template_sha256"] == prefix["template_sha256"], "template receipt binding") + require(invoice["controller_audit_sha256"] == prefix["controller_audit_sha256"], "controller binding") + require(sources["controller_receipt"]["template_sha256"] == invoice["template_sha256"], "controller template") + require(sources["controller_receipt"]["one_owner_per_complete_invocation"] is True, + "whole-invocation receipt") + for pid in ("ck", "jp8"): + program = sources[pid + "_program"] + for orientation in ("forward", "backward"): + actual = digest(json.dumps(program[orientation], separators=(",", ":")).encode()) + require(actual == invoice["providers"][pid]["program_hashes"][orientation], "native program binding") + local = invoice["providers"][pid]["local"][orientation] + prior = sources[pid + "_replay"]["local"][orientation] + require(local["prefix_l1"] == prior["prefix_l1_upper"] and + local["prefix_bits"] == prior["prefix_bits_upper"] and + prior["private_work_erased"] is True, "inherited local prefix binding") + require(local["all_dirty_helper_columns_restored"] is True and + local["private_centres_and_coefficient_work_cleared"] is True and + local["all_exact_columns"] == 716, "inherited scalar receipt") + require(Fraction(local["prefix_l1"]) < 2 ** local["prefix_bits"], "local envelope") + result = schedule_audit(**{k: sources[k] for k in ("parent", "plan", "invoice", "owners")}) + local = max(v["prefix_bits"] for p in invoice["providers"].values() for v in p["local"].values()) + require((local, prefix["stream_input_sup_to_l2_bits"], prefix["primitive_arithmetic_margin_bits"]) == (101, 37, 4), "inherited allowances") + original = local + 37 + result["global_growth_factors"] + 4 + revised = local + 37 + max(result["growth_factors_per_replica"]) + 4 + scheduled = result["local_and_controller_prefix_bits"] + 37 + 4 + require(original == prefix["global_prefix_bits"] == invoice["global_prefix_bits"] == 286, "old bound") + require(scheduled <= revised == 160 < prefix["retained_payload_bits"] == 512, "scoped new bound") + spec = importlib.util.spec_from_file_location("replica_prefix_models", HERE / "model_checks.py") + model = importlib.util.module_from_spec(spec) + spec.loader.exec_module(model) + return { + "status": "PASS_REPLICA_PREFIX_AUDIT", "base_commit": manifest["base_commit"], + "assignment_seed": 72, "schedule": result, + "prefix_bits": {"inherited_local": local, "inherited_input_conversion": 37, + "inherited_arithmetic_margin": 4, "old": original, + "replica_bound": revised, "schedule_sensitive_bound": scheduled, + "reduction": original - revised, "retained_payload": 512}, + "schedule_controls": controls(sources), "finite_models": model.run_checks(), + "scope": "Conditional precision-accounting refinement only; no new kappa, cold supplier replay, physical realization proof or production integration.", + } + + +def main(): + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument("--repo", type=Path, default=ROOT) + parser.add_argument("--record", type=Path, help="write a NEW receipt instead of comparing EXPECTED.json") + args = parser.parse_args() + result = run(args.repo.resolve()) + if args.record: + with args.record.open("x", encoding="utf-8", newline="\n") as handle: + handle.write(json.dumps(result, indent=2, sort_keys=True) + "\n") + else: + require(result == json.loads((HERE / "EXPECTED.json").read_bytes()), "expected receipt mismatch") + print("PASS_REPLICA_PREFIX_AUDIT calls=72 owner_roles=35424 prefix_bits=286->160 retained_payload=512 no_new_kappa") + + +if __name__ == "__main__": + main()