diff --git a/research/bit589-projector-ledger/README.md b/research/bit589-projector-ledger/README.md new file mode 100644 index 0000000000..233eea0ad4 --- /dev/null +++ b/research/bit589-projector-ledger/README.md @@ -0,0 +1,225 @@ +# Independent exact-projector audit of the PR589 bit ledger + +**Independent finite audit; no new supplier, packing bound, endpoint or κ.** +The source-to-ledger check passes for both the untuned PR555 word and the +retained PR589 word. Exact rational orthogonal projectors recover every local +paid rank. The nine-stage schedule and frozen selection recover the global +histogram without using that histogram to infer the idle capacities. + +This deliberately corroborates existing results using a separate implementation. +The original `xcheck_p.py`, `wlib.py` and record exporter already check the local +word; this package does not claim discovery of its correctness or a defect in +those checkers. The additional artifact is a compact independent path from the +two source words to the selected bit invoice, with a different geometric method +and explicit failure controls. + +## Result + +Both words have 636 frames in **Q⁸**, 661 scalar registers over **F₂**, and one +clean, restored COPY temporary. Each forward or reverse record stream has: + +| Item | Count | +|---|---:| +| MOVE records | 2,911 | +| Common-frame ADD records | 24,305 | +| COPY / ERASE records | 9 / 9 | +| Total records | 27,234 | +| Symbolic dirty-input columns | 661 | +| Local paid rank mass, including COPY | 5,129 | + +The exact local profiles are: + +```text +PR555: {1:1321, 2:1342, 3:80, 4:47, 5:102, 6:10, 7:18} +PR589: {1:1323, 2:1342, 3:79, 4:44, 5:102, 6:11, 7:19} +delta: +2 H1 - H3 - 3 H4 + H6 + H7 +``` + +All nine copies have rank seven. Every ordinary input, including all 439 dirty +helper inputs, is represented by a distinct symbolic bit. Both orientations +restore sources and helpers and implement `y_t -> y_t + x_t` on all targets. +The COPY temporary starts and ends at zero in each lifetime. + +The selected nine-stage parameters are `L=9, K=4, T=32, m=64, v=111`. +There are 288 local invocations and 28,416 live data roles. The independently +derived idle remainder per replica is +`{2:435, 4:444, 6:444, 7:666, 42:9}`. Therefore: + +```text +global = 288 * local_PR589 + 32 * idle_per_replica + = {1:381024, 2:400416, 3:22752, 4:26880, + 5:29376, 6:17376, 7:26784, 42:288} +rank mass = 1,808,352 +64 * 28,416 - 1,808,352 = 10,272 +``` + +[RESULT.json](RESULT.json) records both complete profiles, every idle window, +COPY ranks, per-phase ADD counts, exact projector and record-byte digests, and +the 16 rejected controls. It is recomputed and compared on every normal replay; +normal replay writes no package files. + +## Why the projector calculation certifies each local rank + +The label form is one half the standard dot product. Multiplying an inner +product by a positive scalar leaves its orthogonal projectors unchanged. +For each rational frame span F, exact Gram–Schmidt gives nonzero orthogonal +vectors `u_i`; form + +`P_F = Σ_i u_i u_iᵀ / (u_iᵀ u_i)`. + +The checker stores this as an integer matrix `M/d`, and checks symmetry, +`M²=dM` and `tr(M)=d dim(F)` by integer arithmetic. It also checks that the +frame lists **exactly** the live labels fixed by this projector. No modular +rank, floating point, or numerical tolerance is used. + +For two orthogonal projectors P and Q, the test `PQ=P` proves nesting. Taking +transposes gives `QP=P`, so + +`(Q-P)² = Q-P`, and `rank(Q-P) = tr(Q)-tr(P)`. + +An idempotent over Q has eigenvalues zero or one, which justifies the last +equality. Every chronological MOVE must pass this matrix identity and have +positive rank. Reverse replay uses `I-P` and reverses the record order; +`(I-P)-(I-Q)=Q-P` preserves the charge. COPY and ERASE swap roles in reverse. +All ADDs separately require matching current frame IDs, and COPY lifetimes +require an unchanged center and clean temporary restoration. + +The source and target boundary spans contribute `2v(8-1)` to the telescoping +MOVE rank mass; helpers contribute `8R`. Adding the nine COPY charges gives +`2*111*7 + 8*439 + 63 = 5129`. This identity is a cross-check, not a substitute +for reconstructing the individual ranks. + +One control changes the first A gate's frame from the first source line to +the second source line. It leaves the scalar program and the **entire +dimension-only histogram** unchanged. The projector test rejects the first +non-nested transition. This delimits a weakened dimension-only check; the +retained supplier checkers are not alleged to accept this mutation. + +## Independent global decomposition + +The pinned `global_k.py` recipe, its `adapt9p.py` parameterization, and the +replica configuration specify the nine local calls per replica. The independent +transcription aligns pair levels before each bridge and derives the ordered +idle capacities + +`14, 7, 28, 7, 42, 7, 42, 28, 14, 0`. + +For each idle child, a backward scan stops at the last local/bridge touch of +its pair and records the permissible intervening stages. This is a separate +implementation of the pinned `hosting_core.py` window definition. Each positive +capacity has `2v=222` family copies. The frozen selection is checked for family +coverage, allowed stages, pattern capacity, width-eight helper inventory, and +agreement between pattern counts and stage allocations. It assigns all 439 +helpers in each of the nine stages. + +The pending capacity is 41,958 per replica; 3,951 hosted width-eight helpers +consume 31,608. The remaining mass is 10,350. Consequently, + +`288*5129 + 32*10350 = 1808352`, + +and the deficit also equals `32*(2*4*111 - 9*63)=10272`. +Only **after** reconstruction are the published local/global histograms read +as expected values. The selected assembly's immutable input digest, PR589 +identity and COPY deficit bind this comparison to its retained bit source. +The global result is a fixed-selection accounting audit: it does not construct +or replay the physical owners. + +## Reproduce and controls + +Python 3.12, standard library, no network or dependency installation: + +```sh +python3 -I -B research/bit589-projector-ledger/verify.py +python3 -I -B research/bit589-projector-ledger/test_verify.py +python3 -B scripts/research_package.py --package research/bit589-projector-ledger --check-only +python3 -B scripts/research_package.py --package research/bit589-projector-ledger +``` + +Expected audit output: + +```text +PASS_BIT589_PROJECTOR_LEDGER local_mass=5129 global_mass=1808352 deficit=10272 controls=16 +``` + +The seven tests cover six explicit exact-projector fixtures and a differential +check of both full literal record exports and all exported basis/annihilator +operators. The latter invokes the pinned predecessor exporter only as a +secondary compatibility check; `verify.py` does not import or execute it. +Temporary differential outputs are removed on test completion. + +The 16 controls reject non-nesting with equal dimensions, the same-histogram +gate mutation, wrong MOVE/COPY/ERASE charges, omitted dirty restoration or +compensation, wrong scatter frames, missing temporary erasure, idle overfill, +missing families/helpers, an illegal stage window, wrong replica multiplicity, +a rank-mass-preserving histogram change, and a corrupt source pin. Exact +rejection reasons are checked. The verifier uses explicit exceptions, so its +checks remain active with `python3 -O`. + +## Sources, scope and overlap + +Base: `bce54fb3f895cbe5cd4c0eb477c3afeed100190f`. +Retained PR589: `a5afc8c6169ea61ba7c51dfd3cade02cc7b13b46`. +Selected PR1094: `0fc329d0bec93ca7cd288eaea1295172e8789810`. +Exact SHA256 and Git-blob pins are in [SOURCES.json](SOURCES.json). Catalogue +and selected-record pins are historical provenance; implementation inputs are +checked against their working bytes. The source-aware package runner needs +the base commit in Git history. Frozen sources are unchanged. + +The chooser's `independent-moment` card is refined to this source ledger, as +recorded in [TASK.json](TASK.json). Coordination is in discussion #1166. +No pending implementation is imported. Nearby work is explicitly credited: + +- PR1262 independently reconstructs the **complex** emitted ledger. +- PR1293 audits published supplier histograms, endpoint arithmetic and D/E. + PR1405 separately audits that pending package's logarithm enclosure; no + numerical engine or conclusion from either package is used here. +- PR1329 supplies the retained-bit identity guard. Here identity checks only + bind the distinct chronological ledger calculation. +- This account's PR1307 checks cross-child physical pending projectors. The + present selection recount is corroboration, not another physical audit. +- Cinna Davis's PR1351/1371 check one physical family's address operators, + using complete matrix replay and projector algebra respectively. Here the + projectors describe local eight-dimensional label frames and their complete + chronological rank invoice, not that physical family map. +- PR1344 checks the scalar matrix of a particular frame-509 replacement; + PR1345 prices a transport census from per-register frame paths. Those local + arithmetic/path checks are predecessors, not new findings claimed here. +- The incorporated `bit589-width-packing` package already proves the no-bank + packing optimum. This package makes no new packing-ceiling claim. + +Unchecked obligations: complete selected cold replay; native cohort checkers; +the generator's recovery of these frozen compact words; full E8 lattice +classification; every H1–H5 implication; physical owner/chart realization and +global emitted-program equivalence; finite precision; all-size compilation; +moment/surcharge/outer analytic transfer; Lean or a complete multiplication +theorem. The schedule rules are a pinned, reviewed-source transcription, +not a proof of the Python compiler for all parameters. Source hashes establish +identity, not mathematical correctness of these inherited obligations. + +## Open next questions + +The structured questions are in [TASK.json](TASK.json). + +1. Connect this independently derived invoice to each call and remainder of a + source-bound emitted physical program. First pin a complete PR589 replay + capsule and compare its call expansion against this receipt, using PR1307's + separate pending-axis audit. The blocker is the capsule and the full + physical realization contract; matching accounting alone cannot discharge it. +2. Apply this check to one distinct changed bit word before pricing its saving. + This can separate scalar ADD reductions from changes to paid children. A + candidate still needs its own H1–H5 or replacement-interface proof, hosting + and precision evidence; none is supplied by this audit. + +## Credit + +Prepared for commdata2338 (@commdata2338), with substantial OpenAI Codex assistance. +Assistance covered research, implementation, proof explanation, checks and +writing; no independent human review is claimed. New material is Apache-2.0. + +DreamingOfClouds: PR589 tuning and PR545/510/463 geometry and templates. +eumemic: PR555/543/493 scalar words and interface lineage. DaysSky: PR442 +hosting. Dylan Crow: record format/exporter. Zhihao Chen, chafreaky, Jacob +Sussman, Dugongue, Rohan Arun and the retained source authors: preceding +geometry, circuits and transports. Sagar Thakrar: nearby ledger/packing audits; +Navinor: PR1293. Cinna Davis: the nearby local-matrix and physical-family audits. +Original source notices and licenses remain untouched. diff --git a/research/bit589-projector-ledger/RESULT.json b/research/bit589-projector-ledger/RESULT.json new file mode 100644 index 0000000000..cca4bac9e0 --- /dev/null +++ b/research/bit589-projector-ledger/RESULT.json @@ -0,0 +1,430 @@ +{ + "status": "PASS_BIT589_PROJECTOR_LEDGER", + "result_kind": "independent finite audit", + "suppliers": { + "PR555": { + "local": { + "profile": { + "1": 1321, + "2": 1342, + "3": 80, + "4": 47, + "5": 102, + "6": 10, + "7": 18 + }, + "rank_mass": 5129, + "counts": { + "adds": 24305, + "copies": 9, + "erasures": 9, + "moves": 2911 + }, + "adds_by_phase": { + "1": 18085, + "2": 2130, + "3": 527, + "4": 934, + "5": 2629 + }, + "formal_columns": 661, + "records": 27234 + }, + "copy_ranks": [ + 7, + 7, + 7, + 7, + 7, + 7, + 7, + 7, + 7 + ], + "global": { + "profile": { + "1": 380448, + "2": 400416, + "3": 23040, + "4": 27744, + "5": 29376, + "6": 17088, + "7": 26496, + "42": 288 + }, + "local_calls": 288, + "replicas": 32, + "live": 28416, + "width": 64, + "rank_mass": 1808352, + "deficit": 10272, + "idle_per_replica": { + "2": 435, + "4": 444, + "6": 444, + "7": 666, + "42": 9 + }, + "idle_windows": [ + { + "kind": "idle", + "pair": 1, + "rank": 14, + "from": -1, + "to": 1, + "idx": 0, + "stages": [ + 0, + 1 + ] + }, + { + "kind": "idle", + "pair": 1, + "rank": 7, + "from": 1, + "to": 2, + "idx": 1, + "stages": [ + 2 + ] + }, + { + "kind": "idle", + "pair": 2, + "rank": 28, + "from": -1, + "to": 3, + "idx": 2, + "stages": [ + 0, + 1, + 2, + 3 + ] + }, + { + "kind": "idle", + "pair": 2, + "rank": 7, + "from": 3, + "to": 4, + "idx": 3, + "stages": [ + 4 + ] + }, + { + "kind": "idle", + "pair": 3, + "rank": 42, + "from": -1, + "to": 5, + "idx": 4, + "stages": [ + 0, + 1, + 2, + 3, + 4, + 5 + ] + }, + { + "kind": "idle", + "pair": 3, + "rank": 7, + "from": 5, + "to": 6, + "idx": 5, + "stages": [ + 6 + ] + }, + { + "kind": "idle", + "pair": 0, + "rank": 42, + "from": 2, + "to": 8, + "idx": 6, + "stages": [ + 3, + 4, + 5, + 6, + 7, + 8 + ] + }, + { + "kind": "idle", + "pair": 1, + "rank": 28, + "from": 4, + "to": 8, + "idx": 7, + "stages": [ + 5, + 6, + 7, + 8 + ] + }, + { + "kind": "idle", + "pair": 2, + "rank": 14, + "from": 6, + "to": 8, + "idx": 8, + "stages": [ + 7, + 8 + ] + }, + { + "kind": "idle", + "pair": 3, + "rank": 0, + "from": 8, + "to": 8, + "idx": 9, + "stages": [] + } + ], + "hosted_helpers": 126432, + "pending_mass_per_replica": 41958 + }, + "frames": 636, + "projectors_sha256": "4bb901a16a04dd53edd1d8ad65040ad4e0044bd185e4916115d615326aced69a", + "record_bytes_sha256": "f5e4d64c312795db50500f6ce0967fdde6874778f7f47251de257bd4764ff6a9", + "word_payload_sha256": "d0df3c89ae84989f4045ba1681a5e2e9fcdfa38ed0301c8abf5185537155cbe3" + }, + "PR589": { + "local": { + "profile": { + "1": 1323, + "2": 1342, + "3": 79, + "4": 44, + "5": 102, + "6": 11, + "7": 19 + }, + "rank_mass": 5129, + "counts": { + "adds": 24305, + "copies": 9, + "erasures": 9, + "moves": 2911 + }, + "adds_by_phase": { + "1": 18085, + "2": 2130, + "3": 527, + "4": 934, + "5": 2629 + }, + "formal_columns": 661, + "records": 27234 + }, + "copy_ranks": [ + 7, + 7, + 7, + 7, + 7, + 7, + 7, + 7, + 7 + ], + "global": { + "profile": { + "1": 381024, + "2": 400416, + "3": 22752, + "4": 26880, + "5": 29376, + "6": 17376, + "7": 26784, + "42": 288 + }, + "local_calls": 288, + "replicas": 32, + "live": 28416, + "width": 64, + "rank_mass": 1808352, + "deficit": 10272, + "idle_per_replica": { + "2": 435, + "4": 444, + "6": 444, + "7": 666, + "42": 9 + }, + "idle_windows": [ + { + "kind": "idle", + "pair": 1, + "rank": 14, + "from": -1, + "to": 1, + "idx": 0, + "stages": [ + 0, + 1 + ] + }, + { + "kind": "idle", + "pair": 1, + "rank": 7, + "from": 1, + "to": 2, + "idx": 1, + "stages": [ + 2 + ] + }, + { + "kind": "idle", + "pair": 2, + "rank": 28, + "from": -1, + "to": 3, + "idx": 2, + "stages": [ + 0, + 1, + 2, + 3 + ] + }, + { + "kind": "idle", + "pair": 2, + "rank": 7, + "from": 3, + "to": 4, + "idx": 3, + "stages": [ + 4 + ] + }, + { + "kind": "idle", + "pair": 3, + "rank": 42, + "from": -1, + "to": 5, + "idx": 4, + "stages": [ + 0, + 1, + 2, + 3, + 4, + 5 + ] + }, + { + "kind": "idle", + "pair": 3, + "rank": 7, + "from": 5, + "to": 6, + "idx": 5, + "stages": [ + 6 + ] + }, + { + "kind": "idle", + "pair": 0, + "rank": 42, + "from": 2, + "to": 8, + "idx": 6, + "stages": [ + 3, + 4, + 5, + 6, + 7, + 8 + ] + }, + { + "kind": "idle", + "pair": 1, + "rank": 28, + "from": 4, + "to": 8, + "idx": 7, + "stages": [ + 5, + 6, + 7, + 8 + ] + }, + { + "kind": "idle", + "pair": 2, + "rank": 14, + "from": 6, + "to": 8, + "idx": 8, + "stages": [ + 7, + 8 + ] + }, + { + "kind": "idle", + "pair": 3, + "rank": 0, + "from": 8, + "to": 8, + "idx": 9, + "stages": [] + } + ], + "hosted_helpers": 126432, + "pending_mass_per_replica": 41958 + }, + "frames": 636, + "projectors_sha256": "4bb901a16a04dd53edd1d8ad65040ad4e0044bd185e4916115d615326aced69a", + "record_bytes_sha256": "ea44aa047a2a9cf034de8b56b2166c49cf2dbdf9cd9ed6a20299a4f2b05ef09a", + "word_payload_sha256": "5642fd0e35a1acc11acff8d0c08350c1617e95f310d4d35ad63a651f9eeeba0b" + } + }, + "local_profile_delta": { + "1": 2, + "3": -1, + "4": -3, + "6": 1, + "7": 1 + }, + "negative_controls": [ + "same-rank non-nesting", + "same-dimension gate frame", + "wrong MOVE invoice", + "wrong COPY invoice", + "wrong ERASE metadata", + "missing dirty restoration", + "omitted dirt compensation", + "wrong scatter frame", + "missing temporary erase", + "idle overfill", + "missing family", + "wrong stage window", + "missing hosted helper", + "wrong replica multiplicity", + "rank-mass-preserving histogram mutation", + "corrupt source pin" + ], + "scope": "Exact local frame/scalar/record and fixed-selection accounting; physical, compiler, precision and analytic obligations remain." +} diff --git a/research/bit589-projector-ledger/SOURCES.json b/research/bit589-projector-ledger/SOURCES.json new file mode 100644 index 0000000000..97ced1acbd --- /dev/null +++ b/research/bit589-projector-ledger/SOURCES.json @@ -0,0 +1,84 @@ +{ + "schema_version": 1, + "base_commit": "bce54fb3f895cbe5cd4c0eb477c3afeed100190f", + "files": [ + { + "path": "certificates/selected-result.json", + "usage": "provenance", + "git_blob": "ae6a99f28aa468649eb66a361e764d769363bf11", + "sha256": "10b9e340fd8e354a37a0c4813c90e5de1dd42044b5f6aca4a3fc5a42b685fa32" + }, + { + "path": "docs/research/agent-task-catalog.json", + "usage": "provenance", + "git_blob": "c05fafaa25ba95b2d5af86b1800427198e3d20eb", + "sha256": "89b5928bc92c81e2647b6d702a7ad85a6795b8f44e2eb267b2ff3145d8f2b2ce" + }, + { + "path": "research/community-frontier1094-audit/ASSEMBLY.json", + "usage": "input", + "git_blob": "5fd676df060f3b450782fdf5ff5f6beb63a5eeb0", + "sha256": "1122cb3a575f8c788345fc1bf4c108ac7c3250fb81a5988671f5eb04b3ab3045" + }, + { + "path": "research/e8-bit-carrier-skeleton/code/bit/export_records.py", + "usage": "input", + "git_blob": "3632d370486a02f5456f7643ced03f8c925b2350", + "sha256": "8a5999601f917dbb492bb9ae9a344611f18cc7cedc53dc3c76496a369e530eb3" + }, + { + "path": "research/e8-bit-p111-tuned/EXPECTED.json", + "usage": "input", + "git_blob": "c8ad4439e83f07bcda437598d6a4c31f4e65f2a9", + "sha256": "7c2675fd49afd7e328606399a4421fd49c43fe8a6c5b57154cc908c00588abe2" + }, + { + "path": "research/e8-bit-p111-tuned/code/adapt9p.py", + "usage": "input", + "git_blob": "96bbc2ba9bb11984736e34db8b65c1a91e8f842e", + "sha256": "14365d0eb8f4a7352edd28816196148fd28d5bbcb36044ebeeb15ca051bca9de" + }, + { + "path": "research/e8-bit-p111-tuned/data/bitE8mut-p111.json.gz", + "usage": "input", + "git_blob": "bdbb95aa970647bd52895c120b494f0f591f3f87", + "sha256": "1bc3c53d4baf4927c6a00c339ea3975516471a48074d4d97c6addaded2a4d858" + }, + { + "path": "research/e8-bit-p111-tuned/data/selection9-p111.json", + "usage": "input", + "git_blob": "e69ea66a3add357f570fc5552ab6368b3c8f9bb2", + "sha256": "4ab1ed4529683cd184987f8bc3031fb7408b9cd22c25ab9cf541a8aaf896eaf1" + }, + { + "path": "research/e8-bit-p111-tuned/tune/EXPECTED.json", + "usage": "input", + "git_blob": "e293ddc557742637f9f679f083a1a282d87b1b13", + "sha256": "b9f0e5ca038abe837b0007c8fe006f366a6f02009244ac57705a8a200e2301f4" + }, + { + "path": "research/e8-bit-p111-tuned/tune/bitE8mut-p111-tuned.json.gz", + "usage": "input", + "git_blob": "85a4499bf9e4911a705d50567a2c2ef6cf23739a", + "sha256": "e3e301e62bc2b41dbf1ceac0acf3d35824ebeab1848c5a2142d4577b109da52f" + }, + { + "path": "research/e8-bit-p111-tuned/vendor/pr510/e8-r480-nine-stage/vendor/e8-r715-eleven-stage-whole/code/global_k.py", + "usage": "input", + "git_blob": "3df12bd632f1fdba825ced57110a1fee82eb2857", + "sha256": "6368196a393ac25bb2918880e4c4bd31ed733b762c27b6873ab391cbc0c5c3c8" + }, + { + "path": "research/e8-bit-p111-tuned/vendor/pr510/e8-r480-nine-stage/vendor/e8-r740-replica32/code/config.py", + "usage": "input", + "git_blob": "c6824d9c4ea37d58c0d24cb7a3021c4dfcc6f3bb", + "sha256": "283d7fad45155ee91e704d63ec947cf4a60aeff5cc43510bc0e835f7da7d8767" + }, + { + "path": "research/e8-bit-p111-tuned/vendor/pr510/e8-r480-nine-stage/vendor/idle-axis-hosting/hosting_core.py", + "usage": "input", + "git_blob": "68b536daa9e6546c0aa046934bf840aaa3c3fde3", + "sha256": "d8b90cd5d152df3c7c351230863d9e61816ad5e1f21d69bea1a86a5daad559a3" + } + ] +} diff --git a/research/bit589-projector-ledger/TASK.json b/research/bit589-projector-ledger/TASK.json new file mode 100644 index 0000000000..b79ddbec68 --- /dev/null +++ b/research/bit589-projector-ledger/TASK.json @@ -0,0 +1,86 @@ +{ + "schema_version": 1, + "task_id": "independent-moment", + "priority_revision": 2, + "base_commit": "bce54fb3f895cbe5cd4c0eb477c3afeed100190f", + "original_card": { + "id": "independent-moment", + "question": "Can one selected pricing or assembly claim be checked by a genuinely independent exact implementation?", + "starting_points": [ + "certificates/selected-result.json" + ], + "methods": [ + "Reconstruct the rank ledger from original operations rather than trusting its aggregate.", + "Implement certified moment inequalities through a different exact enclosure method." + ], + "acceptance_gate": "Demonstrate independence, source binding, positive cases and semantic failure controls.", + "first_step": { + "command": [ + "python3", + "-B", + "scripts/research_baseline.py" + ], + "expected": "PASS_RESEARCH_BASELINE_BINDINGS_ONLY", + "inspect": "Record the selected certificate and complex_profile rather than taking a PR headline as input.", + "scope": "Positive control / source-bound orientation only; this is not a new construction or full cold replay." + }, + "first_experiment": "Recompute one small part of the ledger or one certified enclosure using an independent implementation.", + "bottleneck_link": "Independent pricing prevents unsupported frontier claims and can reveal genuine accounting slack.", + "allowed_variations": [ + "Reconstruct either a source ledger or a numeric enclosure with a different method." + ], + "scope_change_triggers": [ + "Importing the primary function and calling its output independent verification." + ], + "overlap_terms": [ + "independent moment", + "rank histogram", + "exact enclosure" + ] + }, + "scope_status": "refined", + "actual_scope": "Independent exact-projector reconstruction of both PR555/PR589 local paid ledgers and the selected PR589 nine-stage, 32-replica histogram from source gates and selection.", + "scope_change_reason": "Preserves the assigned source-ledger method; fixes the bit supplier and rational projector method. Existing complex-ledger and numerical endpoint audits are credited, not repeated.", + "bottleneck_link": "Checks the source-to-rank-invoice premise of the retained bit supplier; does not alter the currently binding complex supplier or the selected exponent.", + "budget_minutes": 60, + "stop_rule": "About 60 minutes; reserve the final quarter for checks. Hand off partial coverage if source reconstruction cannot be finished. No optimizer or full cold replay.", + "outcome": "completed", + "evidence": "RESULT.json: both 636-frame words, all 661 dirty columns in both orientations, 27234 records per orientation, local mass 5129 and global mass 1808352 with deficit 10272; 16 semantic/source controls.", + "author": "commdata2338", + "ai_assistance": "Prepared for commdata2338 (@commdata2338), with substantial OpenAI Codex assistance in research, implementation, proof explanation, testing and writing. No independent human review is claimed.", + "open_questions": [ + { + "question": "Can the independent projector invoice be connected to the actual emitted physical owner program, including each invocation and remainder operator?", + "why_it_matters": "The present result checks local words and fixed-selection arithmetic. Physical realization is a separate inherited implication.", + "first_step": "Pin a complete PR589 cold-replay capsule and compare every emitted local call and idle remainder with this derived ledger; use PR1307 for the separate pending-axis audit.", + "blocked_by": "A source-bound emitted capsule and the full physical hosting/realization contracts are required." + }, + { + "question": "Can a concrete changed bit word alter the paid profile while preserving the necessary frame and dirty-state conditions?", + "why_it_matters": "A scalar ADD reduction or packing headline alone does not establish a larger primitive saving.", + "first_step": "Run this source-ledger method on one pinned candidate and compare the complete histogram and COPY bill before endpoint pricing.", + "blocked_by": "A distinct candidate plus its own full H1-H5 or replacement-interface, hosting and precision evidence." + } + ], + "chooser": { + "nonce": "941551c5c8443ceafec83371687af2c5", + "track": "independent-verification", + "scope_key": "c6f2494b197df3bc3591" + }, + "predecessor_heads": { + "PR589": "a5afc8c6169ea61ba7c51dfd3cade02cc7b13b46", + "selected_PR1094": "0fc329d0bec93ca7cd288eaea1295172e8789810" + }, + "context_heads": { + "PR1262": "4b196b40dcac3ec40f62ec285babac53a1b5a3c5", + "PR1293": "85a361233431befe4b11cf878f7b1b77a244d473", + "PR1329": "1356813dddd0e03ea138743a799c2aece15f7d44", + "PR1307": "4cb255ef445e2abc3ff8845fa01210b974e2cf6c", + "PR1351": "6060e62e9d42a16eff493aba74c8a617a12d8041", + "PR1371": "d47c4c300a53bb206becd13db89cea8c287c929b", + "PR1344": "a42e525e9868970f3fa2d99dccca45f014aa0fd3", + "PR1345": "b54a856aa79857d91cd5d65f8f7144e26c8c084f", + "PR1405": "917199f88adbc2cb9e402a150acb71f4ebf63d5f" + }, + "coordination": "The claim is in discussion #1166, comment 18911778. No pending implementation is imported." +} diff --git a/research/bit589-projector-ledger/VERIFY.json b/research/bit589-projector-ledger/VERIFY.json new file mode 100644 index 0000000000..8cfa2c2c59 --- /dev/null +++ b/research/bit589-projector-ledger/VERIFY.json @@ -0,0 +1,41 @@ +{ + "schema_version": 1, + "status": "ready", + "python": "3.12", + "requirements": [], + "inputs": [ + "research/community-frontier1094-audit/ASSEMBLY.json", + "research/e8-bit-carrier-skeleton/code/bit/export_records.py", + "research/e8-bit-p111-tuned/EXPECTED.json", + "research/e8-bit-p111-tuned/code/adapt9p.py", + "research/e8-bit-p111-tuned/data/bitE8mut-p111.json.gz", + "research/e8-bit-p111-tuned/data/selection9-p111.json", + "research/e8-bit-p111-tuned/tune/EXPECTED.json", + "research/e8-bit-p111-tuned/tune/bitE8mut-p111-tuned.json.gz", + "research/e8-bit-p111-tuned/vendor/pr510/e8-r480-nine-stage/vendor/e8-r715-eleven-stage-whole/code/global_k.py", + "research/e8-bit-p111-tuned/vendor/pr510/e8-r480-nine-stage/vendor/e8-r740-replica32/code/config.py", + "research/e8-bit-p111-tuned/vendor/pr510/e8-r480-nine-stage/vendor/idle-axis-hosting/hosting_core.py" + ], + "commands": [ + { + "argv": [ + "{python}", + "-I", + "-B", + "{package}/verify.py" + ], + "timeout_seconds": 180, + "checks": "Exact source pins, both words and orientations, full local record invoice, fixed-selection global ledger, unchanged receipt and 16 rejection controls." + }, + { + "argv": [ + "{python}", + "-I", + "-B", + "{package}/test_verify.py" + ], + "timeout_seconds": 180, + "checks": "Six exact projector fixtures and a differential test of both complete literal record exports and every basis/annihilator projector; the main audit imports no predecessor implementation." + } + ] +} diff --git a/research/bit589-projector-ledger/test_verify.py b/research/bit589-projector-ledger/test_verify.py new file mode 100644 index 0000000000..745649d417 --- /dev/null +++ b/research/bit589-projector-ledger/test_verify.py @@ -0,0 +1,94 @@ +#!/usr/bin/env python3 +"""Independent fixtures and failure boundaries for the finite ledger audit. + +Prepared for commdata2338 with substantial OpenAI Codex assistance. Apache-2.0. +""" +import importlib.util +import gzip +import json +from pathlib import Path +import struct +import subprocess +import sys +import tempfile +import unittest + +HERE = Path(__file__).resolve().parent +SPEC = importlib.util.spec_from_file_location('projector_ledger', HERE/'verify.py') +audit = importlib.util.module_from_spec(SPEC) +SPEC.loader.exec_module(audit) + + +class ProjectorFixtures(unittest.TestCase): + def test_oblique_line_exact_matrix(self): + # The line (1,2) has P=[[1,2],[2,4]]/5, not a coordinate mask. + line = (1, 2, 0, 0, 0, 0, 0, 0) + matrix = [[0]*8 for _ in range(8)] + matrix[0][:2] = [1, 2] + matrix[1][:2] = [2, 4] + expected = (tuple(map(tuple, matrix)), 5, 1) + self.assertEqual(audit.projector((line,)), expected) + self.assertTrue(audit.fixes(expected, line)) + self.assertFalse(audit.fixes(expected, (1, 0, 0, 0, 0, 0, 0, 0))) + + def test_basis_change_does_not_change_subspace(self): + rows = ((1, 2, 0, 0, 0, 0, 0, 0), (0, 1, 3, 0, 0, 0, 0, 0)) + changed = (tuple(a+7*b for a, b in zip(*rows)), tuple(-3*x for x in rows[1])) + self.assertEqual(audit.projector(rows), audit.projector(changed)) + + def test_same_dimension_is_not_nesting(self): + x = audit.projector(((1, 0, 0, 0, 0, 0, 0, 0),)) + y = audit.projector(((0, 1, 0, 0, 0, 0, 0, 0),)) + self.assertEqual(x[2], y[2]) + with self.assertRaisesRegex(audit.Reject, 'non-nested'): + audit.increase(x, y) + + def test_complement_reverses_nesting(self): + x = audit.projector(((1, 2, 0, 0, 0, 0, 0, 0),)) + xy = audit.projector(((1, 0, 0, 0, 0, 0, 0, 0), (0, 1, 0, 0, 0, 0, 0, 0))) + self.assertEqual(audit.increase(x, xy), 1) + self.assertEqual(audit.increase(audit.complement(xy), audit.complement(x)), 1) + with self.assertRaisesRegex(audit.Reject, 'non-nested'): + audit.increase(xy, x) + + def test_nonprojector_rejected_despite_integer_trace(self): + matrix = [[0]*8 for _ in range(8)] + matrix[0][1] = matrix[1][0] = 1 + with self.assertRaisesRegex(audit.Reject, 'idempotence'): + audit.validate_projector((tuple(map(tuple, matrix)), 1, 0)) + + def test_zero_full_and_redundant_spanning_rows(self): + zero = audit.projector(()) + rows = tuple(tuple(int(i == j) for i in range(8)) for j in range(8)) + full = audit.projector(rows + rows) + self.assertEqual(audit.increase(zero, full), 8) + self.assertEqual(audit.complement(full), zero) + + +class SourceCompatibility(unittest.TestCase): + def test_both_literal_exports_and_frame_operators(self): + # Secondary cross-check only: the main verifier never invokes/imports + # this predecessor exporter and derives its own charges independently. + raw = audit.inputs() + exporter = audit.ROOT/'research/e8-bit-carrier-skeleton/code/bit/export_records.py' + for relative in ('data/bitE8mut-p111.json.gz', 'tune/bitE8mut-p111-tuned.json.gz'): + with self.subTest(word=relative), tempfile.TemporaryDirectory(prefix='bit589-export-') as tmp: + path = audit.ROOT/(audit.BIT+relative) + word = json.loads(gzip.decompress(raw[audit.BIT+relative])) + spaces, zero = audit.geometry(word) + tape = audit.records(word, spaces, zero) + subprocess.run([sys.executable, '-I', '-B', str(exporter), str(path), tmp], + check=True, timeout=60, capture_output=True, text=True) + expected = b''.join(struct.pack('<6i', *event) for event in tape) + self.assertEqual((Path(tmp)/'249-records.bin').read_bytes(), expected) + frames = json.loads((Path(tmp)/'frames.json').read_text())['frames'] + self.assertEqual(len(frames), len(spaces)) + for index, projection in enumerate(spaces): + frame = frames[str(index)] + self.assertEqual(audit.projector(tuple(map(tuple, frame['B']))), projection) + self.assertEqual(audit.projector(tuple(map(tuple, frame['A']))), + audit.complement(projection)) + + +if __name__ == '__main__': + unittest.main() diff --git a/research/bit589-projector-ledger/verify.py b/research/bit589-projector-ledger/verify.py new file mode 100644 index 0000000000..d0a02e8474 --- /dev/null +++ b/research/bit589-projector-ledger/verify.py @@ -0,0 +1,500 @@ +#!/usr/bin/env python3 +"""Independent exact-projector PR589 ledger. Standard library only. + +Prepared for commdata2338 with substantial OpenAI Codex assistance. +Construction credit: DreamingOfClouds, eumemic and the README's lineage. +SPDX-License-Identifier: Apache-2.0 +""" +import argparse +from collections import Counter +from copy import deepcopy +from fractions import Fraction as Q +from functools import lru_cache +import gzip +import hashlib +import json +from math import gcd, lcm +from pathlib import Path +import struct + +HERE = Path(__file__).resolve().parent +ROOT = HERE.parents[1] +BIT = 'research/e8-bit-p111-tuned/' +VENDOR = BIT + 'vendor/pr510/e8-r480-nine-stage/vendor/' +H = 8 + + +class Reject(ValueError): + pass + + +def need(ok, message): + if not ok: + raise Reject(message) + + +def digest(data): + return hashlib.sha256(data).hexdigest() + + +def canonical(obj): + return json.dumps(obj, sort_keys=True, separators=(',', ':')).encode() + + +def integer(x, lo=0, hi=None): + return type(x) is int and x >= lo and (hi is None or x <= hi) + + +def hist(counter): + return {str(k): counter[k] for k in sorted(counter) if counter[k]} + + +def check_digest(raw, expected): + need(digest(raw) == expected, 'source digest') + + +def inputs(): + manifest = json.loads((HERE / 'SOURCES.json').read_text()) + raw = {} + for row in manifest['files']: + if row['usage'] == 'input': + path = (ROOT / row['path']).resolve() + need(path.is_relative_to(ROOT), 'source outside repository') + raw[row['path']] = path.read_bytes() + check_digest(raw[row['path']], row['sha256']) + return raw + + +def dot(x, y): + return sum(a*b for a, b in zip(x, y)) + + +@lru_cache(maxsize=2048) +def projector(rows): + """Gram-Schmidt P=sum uu^t/(u^t u); exact integer numerator M/den. + + The cache key contains all coordinates, never just a frame ID or digest. + This uses neither the predecessor's row reduction nor its nullspace code. + """ + basis = [] + for row in rows: + need(len(row) == H and all(type(x) is int for x in row), 'label coordinates') + u = list(map(Q, row)) + for v, norm in basis: + c = dot(u, v)/norm + u = [a-c*b for a, b in zip(u, v)] + norm = dot(u, u) + if norm: + basis.append((u, norm)) + if len(basis) == H: + break # geometry() still checks closure against every live label + p = [[sum((u[i]*u[j]/norm for u, norm in basis), Q(0)) + for j in range(H)] for i in range(H)] + den = lcm(*(x.denominator for row in p for x in row)) + a = tuple(tuple(int(x*den) for x in row) for row in p) + common = gcd(den, *(x for row in a for x in row)) + a = tuple(tuple(x//common for x in row) for row in a) + den //= common + rank = len(basis) + out = (a, den, rank) + validate_projector(out) + return out + + +def validate_projector(p): + a, den, rank = p + need(integer(den, 1) and integer(rank, 0, H), 'projector header') + need(len(a) == H and all(len(row) == H for row in a), 'projector shape') + need(all(a[i][j] == a[j][i] for i in range(H) for j in range(H)), 'symmetry') + need(all(sum(a[i][k]*a[k][j] for k in range(H)) == den*a[i][j] + for i in range(H) for j in range(H)), 'idempotence') + need(sum(a[i][i] for i in range(H)) == den*rank, 'integer trace') + + +def fixes(p, v): + a, den, _ = p + return all(dot(row, v) == den*x for row, x in zip(a, v)) + + +@lru_cache(maxsize=16384) +def increase(old, new): + """Nested orthogonal projectors have rank(new-old)=trace(new)-trace(old).""" + a, da, ra = old + b, db, rb = new + need(all(sum(a[i][k]*b[k][j] for k in range(H)) == db*a[i][j] + for i in range(H) for j in range(H)), 'non-nested projectors') + need(rb >= ra, 'negative projector difference') + return rb-ra + + +def complement(p): + a, den, rank = p + return (tuple(tuple(den*int(i == j)-a[i][j] for j in range(H)) + for i in range(H)), den, H-rank) + + +def geometry(word): + need(word['h'] == H and word['form'] == '/2', 'label-space contract') + v, r = word['v'], word['R'] + need(integer(v, 1) and integer(r, 1), 'register counts') + lines = tuple(tuple(row) for row in word['lines']) + need(len(lines) == v and len(set(lines)) == v, 'label inventory') + need(all(len(x) == H and all(type(y) is int for y in x) and dot(x, x) == 4 + for x in lines), 'root norms') + need(all(abs(dot(x, y)) <= 2 for i, x in enumerate(lines) for y in lines[i+1:]), + 'distinct root lines') + spaces = [] + for frame in word['frames']: + need(frame == sorted(set(frame)) and all(integer(i, 0, v-1) for i in frame), + 'frame index set') + p = projector(tuple(lines[i] for i in frame)) + need([i for i, row in enumerate(lines) if fixes(p, row)] == frame, 'frame closure') + spaces.append(p) + zero = [i for i, p in enumerate(spaces) if p[2] == 0] + full = [i for i, p in enumerate(spaces) if p[2] == H] + need(len(zero) == len(full) == 1, 'unique zero/full') + n = 2*v+r + for label in ('start', 'final'): + need(len(word[label]) == n and all(integer(f, 0, len(spaces)-1) for f in word[label]), + label+' frame inventory') + for i in range(n): + start, final = spaces[word['start'][i]], spaces[word['final'][i]] + if i < v: + need(start == projector((lines[i],)) and final[2] == H, 'source boundary') + elif i < 2*v: + need(start[2] == 0 and final == complement(projector((lines[i-v],))), 'target boundary') + else: + need(start[2] == 0 and final[2] == H, 'helper boundary') + return spaces, zero[0] + + +def records(word, spaces, zero): + """Independently expand gates into the source's six-integer record vocabulary.""" + v, n = word['v'], 2*word['v']+word['R'] + current, out = list(word['start']), [] + + def move(register, frame): + old = current[register] + if old != frame: + cost = increase(spaces[old], spaces[frame]) + need(cost > 0, 'distinct frame with no rank change') + out.append((0, register, old, frame, cost, 0)) + current[register] = frame + + def gates(section, phase): + for frame, target, sources in word[section]: + need(integer(frame, 0, len(spaces)-1), 'gate frame') + operands = [target, *sources] + need(all(integer(i, 0, n-1) for i in operands) and len(set(operands)) == len(operands), + 'gate operands') + for i in operands: + move(i, frame) + out.extend((1, target, source, 1, frame, phase) for source in sources) + + gates('D', 1) + gates('A', 2) + need(len(word['scatter']) == v, 'scatter rows') + retained = word['ret'] + need(len(set(retained)) == len(retained) and all(integer(q, 2*v, n-1) for q in retained), + 'retained helpers') + need(all(row == sorted(set(row)) and all(integer(k, 0, len(retained)-1) for k in row) + for row in word['scatter']), 'scatter indices') + for k, center in enumerate(retained): + frame = current[center] + out.append((2, center, n, frame, zero, spaces[frame][2])) + out.extend((1, v+t, n, 1, zero, 3) for t, row in enumerate(word['scatter']) if k in row) + out.append((3, center, n, frame, zero, 0)) + gates('B', 4) + gates('C', 5) + for register, frame in enumerate(word['final']): + move(register, frame) + return out + + +def replay(word, spaces, tape, reverse=False): + """All dirty columns at once; the reverse uses complementary projectors.""" + v, n = word['v'], 2*word['v']+word['R'] + current = list(word['final'] if reverse else word['start'])+[None] + value = [1 << i for i in range(n)]+[0] + effective = [complement(p) for p in spaces] if reverse else spaces + center = None + paid, counts, phases = Counter(), Counter(), Counter() + for op, x, y, a, b, c in (reversed(tape) if reverse else tape): + need(op in (0, 1, 2, 3) and integer(x, 0, n-1), 'record opcode/role') + if op == 0: + old, new = (a, y) if reverse else (y, a) + need(integer(old, 0, len(spaces)-1) and integer(new, 0, len(spaces)-1), 'MOVE frames') + need(current[x] == old, 'MOVE chronology') + rank = increase(effective[old], effective[new]) + need(integer(b, 1, H) and b == rank and c == 0, 'MOVE rank') + current[x] = new + paid[rank] += 1 + counts['moves'] += 1 + elif op == 1: + need(integer(y, 0, n) and x != y and a == 1, 'ADD operands') + need(current[x] == current[y] == b, 'ADD common frame') + need(x != center and (y != n or center is not None), 'COPY lifetime') + value[x] ^= value[y] + counts['adds'] += 1 + phases[c] += 1 + elif op == (3 if reverse else 2): + need(center is None and y == n and value[n] == 0 and current[n] is None, + 'COPY clean temporary') + need(current[x] == a and integer(b, 0, len(spaces)-1), 'COPY frame') + source, target = effective[a], effective[b] + rank = increase(source, target) if source[2] <= target[2] else increase(target, source) + need(rank > 0 and c == (0 if reverse else rank), 'COPY rank') + center, current[n], value[n] = x, b, value[x] + paid[rank] += 1 + counts['copies'] += 1 + else: + need(center == x and y == n and current[x] == a and current[n] == b, 'ERASE lifetime') + need(value[n] == value[x], 'ERASE dirty residue') + need(c == (abs(effective[a][2]-effective[b][2]) if reverse else 0), 'ERASE metadata') + center, current[n], value[n] = None, None, 0 + counts['erasures'] += 1 + need(center is None and current[n] is None and value[n] == 0, 'temporary restoration') + need(current[:n] == (word['start'] if reverse else word['final']), 'final frames') + want = [(1 << i) ^ ((1 << (i-v)) if v <= i < 2*v else 0) for i in range(n)] + need(value[:n] == want, 'arbitrary-dirty scalar endpoint') + return {'profile': hist(paid), 'rank_mass': sum(k*v for k, v in paid.items()), + 'counts': dict(sorted(counts.items())), 'adds_by_phase': hist(phases), + 'formal_columns': n, 'records': len(tape)} + + +def schedule(): + """Derive idle ranks by aligning pair levels before each source-recipe bridge.""" + levels, events = [-1]*4, [] + idle_index = 0 + + def advance(pair, level): + nonlocal idle_index + need(level >= levels[pair], 'schedule descent') + events.append({'kind': 'idle', 'pair': pair, 'rank': 7*(level-levels[pair]), + 'from': levels[pair], 'to': level, 'idx': idle_index}) + levels[pair] = level + idle_index += 1 + + for stage in range(9): + pair = max(0, (stage-1)//2) + need(levels[pair] == stage-1, 'local schedule level') + events.append({'kind': 'local', 'stage': stage, 'pair': pair, 'reverse': bool(stage % 2)}) + levels[pair] = stage + if 1 <= stage <= 6: + advance(pair+1, stage) + events.append({'kind': 'bridge', 'dst': pair, 'src': pair+1}) + for pair in range(4): + advance(pair, 8) + for pair in (2, 1, 0): + events.append({'kind': 'bridge', 'dst': pair+1, 'src': pair}) + return events + + +def global_ledger(local, selection, v, helpers, replicas=32): + events, windows = schedule(), {} + for pos, event in enumerate(events): + if event['kind'] != 'idle': + continue + pair, stages = event['pair'], [] + for prior in reversed(events[:pos]): + if (prior['kind'] == 'local' and prior['pair'] == pair) or ( + prior['kind'] == 'bridge' and pair in (prior['dst'], prior['src'])): + break + if prior['kind'] == 'local': + stages.append(prior['stage']) + windows[event['idx']] = {**event, 'stages': sorted(stages)} + available = {i: w for i, w in windows.items() if w['rank'] and w['stages']} + copies, capacities, stage_totals, idle = Counter(), Counter(), Counter(), Counter() + seen = set() + for index, widths, count in selection['patterns']: + need(index in available and integer(count, 1), 'pattern index/count') + need(all(type(w) is int and w == H for w in widths), 'helper width') + need((index, tuple(widths)) not in seen, 'duplicate pattern') + seen.add((index, tuple(widths))) + remainder = available[index]['rank']-sum(widths) + need(remainder >= 0, 'pattern exceeds capacity') + copies[index] += count + capacities[index] += count*len(widths) + if remainder: + idle[remainder] += count + need(dict(copies) == {i: 2*v for i in available}, 'pattern family coverage') + allocated, seen = Counter(), set() + for index, width, stage, count in selection['stages']: + need(index in available and stage in available[index]['stages'], 'stage outside idle window') + need(type(width) is int and width == H and integer(count, 1), 'allocation width/count') + need((index, width, stage) not in seen, 'duplicate allocation') + seen.add((index, width, stage)) + allocated[index] += count + stage_totals[stage] += count + need(allocated == capacities, 'allocation/pattern counts') + need(dict(stage_totals) == {s: helpers for s in range(9)}, 'helper stage inventory') + for index, window in windows.items(): + if index not in available and window['rank']: + idle[window['rank']] += 2*v + need(integer(replicas, 1), 'replica count') + calls = sum(e['kind'] == 'local' for e in events)*replicas + paid = Counter({int(k): count*calls for k, count in local.items()}) + paid.update({rank: count*replicas for rank, count in idle.items()}) + live, width = 2*4*v*replicas, 1+7*9 + mass = sum(rank*count for rank, count in paid.items()) + return {'profile': hist(paid), 'local_calls': calls, 'replicas': replicas, + 'live': live, 'width': width, 'rank_mass': mass, 'deficit': width*live-mass, + 'idle_per_replica': hist(idle), 'idle_windows': list(windows.values()), + 'hosted_helpers': sum(stage_totals.values())*replicas, + 'pending_mass_per_replica': sum(2*v*w['rank'] for w in windows.values())} + + +def compare(actual, expected): + need(actual == expected, 'ledger / receipt mismatch') + + +def reject_control(name, action, reason): + try: + action() + except Reject as exc: + need(reason in str(exc), name+': unexpected rejection: '+str(exc)) + return name + raise Reject(name+': accepted') + + +def controls(word, spaces, zero, tape, global_result, selection): + passed = [] + def check(name, action, reason): + passed.append(reject_control(name, action, reason)) + + e0 = projector(((1, 0, 0, 0, 0, 0, 0, 0),)) + e1 = projector(((0, 1, 0, 0, 0, 0, 0, 0),)) + need(e0[2] == e1[2], 'equal-dimension control premise') + check('same-rank non-nesting', lambda: increase(e0, e1), 'non-nested') + bad = deepcopy(word); bad['A'][0][0] = word['start'][1] + # This deliberately weakened calculation is a failure-control premise only. + # It ignores subspace containment, and must never be an acceptance path. + def dimension_only(w): + cur, bill = list(w['start']), Counter() + def move(i, f): + rank = spaces[f][2]-spaces[cur[i]][2] + need(rank >= 0, 'dimension-only control has a descent') + if rank: + bill[rank] += 1 + cur[i] = f + for section in ('D', 'A', 'B', 'C'): + if section == 'B': + bill.update(spaces[cur[q]][2] for q in w['ret']) + for f, target, sources in w[section]: + for i in [target, *sources]: + move(i, f) + for i, f in enumerate(w['final']): + move(i, f) + return hist(bill) + need(dimension_only(bad) == dimension_only(word), 'same-histogram frame mutant premise') + need(all([g[1:] for g in bad[s]] == [g[1:] for g in word[s]] for s in ('D', 'A', 'B', 'C')), + 'same-scalar-program frame mutant premise') + check('same-dimension gate frame', lambda: records(bad, spaces, zero), 'non-nested') + for name, op, field, reason in ( + ('wrong MOVE invoice', 0, 4, 'MOVE rank'), + ('wrong COPY invoice', 2, 5, 'COPY rank'), + ('wrong ERASE metadata', 3, 5, 'ERASE metadata')): + mutated = list(tape) + i = next(i for i, e in enumerate(tape) if e[0] == op) + e = list(mutated[i]); e[field] += 1; mutated[i] = tuple(e) + check(name, lambda t=mutated: replay(word, spaces, t), reason) + for name, section in (('missing dirty restoration', 'C'), ('omitted dirt compensation', 'D')): + bad = deepcopy(word) + if section == 'C': + bad[section].pop(0) + else: + bad[section][0][2].pop() + bad_tape = records(bad, spaces, zero) + check(name, lambda: replay(bad, spaces, bad_tape), 'scalar endpoint') + bad_tape = list(tape) + i = next(i for i, e in enumerate(tape) if e[0] == 1 and e[5] == 3) + e = list(bad_tape[i]); e[4] = word['start'][0]; bad_tape[i] = tuple(e) + check('wrong scatter frame', lambda: replay(word, spaces, bad_tape), 'common frame') + bad_tape = list(tape); bad_tape.pop(next(i for i, e in enumerate(tape) if e[0] == 3)) + check('missing temporary erase', lambda: replay(word, spaces, bad_tape), 'clean temporary') + local = replay(word, spaces, tape)['profile'] + for name, mutate, reason in ( + ('idle overfill', lambda s: s['patterns'][0][1].append(8), 'exceeds capacity'), + ('missing family', lambda s: s['patterns'][0].__setitem__(2, 221), 'family coverage'), + ('wrong stage window', lambda s: s['stages'][0].__setitem__(2, 2), 'outside idle window'), + ('missing hosted helper', lambda s: s['stages'][0].__setitem__(3, 221), 'allocation/pattern')): + bad = deepcopy(selection); mutate(bad) + check(name, lambda s=bad: global_ledger(local, s, word['v'], word['R']), reason) + wrong = global_ledger(local, selection, word['v'], word['R'], replicas=31) + check('wrong replica multiplicity', lambda: compare(wrong, global_result), 'ledger') + bad = deepcopy(local); bad['1'] += 2; bad['2'] -= 1 + need(sum(int(k)*v for k, v in bad.items()) == sum(int(k)*v for k, v in local.items()), + 'rank-mass-preserving control premise') + check('rank-mass-preserving histogram mutation', lambda: compare(bad, local), 'ledger') + check('corrupt source pin', lambda: check_digest(b'bad', digest(b'good')), 'source digest') + return passed + + +def compute(): + raw = inputs() + config = raw[VENDOR+'e8-r740-replica32/code/config.py'].decode() + need('\nREPLICAS = 32\n' in config, 'replica source binding') + selection = json.loads(raw[BIT+'data/selection9-p111.json'])['bit'] + reports, words, all_spaces, all_tapes = {}, {}, {}, {} + for label, word_path, expected_path in ( + ('PR555', BIT+'data/bitE8mut-p111.json.gz', BIT+'EXPECTED.json'), + ('PR589', BIT+'tune/bitE8mut-p111-tuned.json.gz', BIT+'tune/EXPECTED.json')): + word = json.loads(gzip.decompress(raw[word_path])) + expected = json.loads(raw[expected_path]) + need(digest(canonical(word)) == expected['word']['content_sha256'], 'word payload binding') + spaces, zero = geometry(word) + tape = records(word, spaces, zero) + forward, reverse = replay(word, spaces, tape), replay(word, spaces, tape, True) + need(forward == reverse, 'forward/reverse ledger') + need(forward['profile'] == expected['word']['local_histogram'], 'local histogram') + copies = [e[5] for e in tape if e[0] == 2] + need(forward['rank_mass'] == H*word['R']+2*word['v']*(H-1)+sum(copies), + 'local telescoping rank mass') + need({'records': len(tape), 'common_frame_ADDs': forward['counts']['adds'], + 'rank_mass': forward['rank_mass']} == expected['word']['legality'], 'record inventory') + need(copies == expected['word']['copy_ranks'], 'COPY ranks') + global_result = global_ledger(forward['profile'], selection, word['v'], word['R']) + need(global_result['profile'] == expected['nine']['profile'], 'nine-stage histogram') + need(global_result['rank_mass'] == expected['nine']['bit']['rank_mass'], 'global rank mass') + need(global_result['deficit'] == 32*(8*word['v']-9*sum(copies)), 'global coverage identity') + reports[label] = {'local': forward, 'copy_ranks': copies, 'global': global_result, + 'frames': len(spaces), 'projectors_sha256': digest(canonical(spaces)), + 'record_bytes_sha256': digest(b''.join(struct.pack('<6i', *e) for e in tape)), + 'word_payload_sha256': digest(canonical(word))} + words[label], all_spaces[label], all_tapes[label] = word, spaces, tape + assembly = json.loads(raw['research/community-frontier1094-audit/ASSEMBLY.json']) + supplier = assembly['bit_supplier'] + need(supplier['path'] == BIT+'tune/EXPECTED.json' and supplier['commit'] == + 'a5afc8c6169ea61ba7c51dfd3cade02cc7b13b46', 'assembly supplier identity') + need(assembly['input_sha256'].get('package:inputs/PR589-EXPECTED.json') == + digest(raw[BIT+'tune/EXPECTED.json']), 'assembly expected-record digest') + need(supplier['derived_deficit'] == reports['PR589']['global']['deficit'], 'assembly deficit') + delta = {str(k): reports['PR589']['local']['profile'].get(str(k), 0)- + reports['PR555']['local']['profile'].get(str(k), 0) for k in range(1, H+1)} + delta = {k: v for k, v in delta.items() if v} + need(delta == {'1': 2, '3': -1, '4': -3, '6': 1, '7': 1}, 'transport delta') + word, spaces, tape = words['PR589'], all_spaces['PR589'], all_tapes['PR589'] + zero = next(i for i, p in enumerate(spaces) if p[2] == 0) + checks = controls(word, spaces, zero, tape, reports['PR589']['global'], selection) + return {'status': 'PASS_BIT589_PROJECTOR_LEDGER', 'result_kind': 'independent finite audit', + 'suppliers': reports, 'local_profile_delta': delta, 'negative_controls': checks, + 'scope': 'Exact local frame/scalar/record and fixed-selection accounting; physical, compiler, precision and analytic obligations remain.'} + + +def main(): + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument('--write-result', action='store_true', help='create RESULT.json exclusively') + args = parser.parse_args() + result = compute() + path = HERE/'RESULT.json' + if args.write_result: + with path.open('x') as stream: + stream.write(json.dumps(result, indent=2)+'\n') + else: + compare(result, json.loads(path.read_text())) + print(result['status'], 'local_mass=5129 global_mass=1808352 deficit=10272', + 'controls='+str(len(result['negative_controls']))) + + +if __name__ == '__main__': + main()