From 50c6ae8151493af21d284afe34fb35f68f6d4934 Mon Sep 17 00:00:00 2001 From: Joel Pulikkan Date: Tue, 13 Oct 2026 10:11:15 -0400 Subject: [PATCH] Raise conditional kappa to 0.001661960547713947 with a T37 owner map Compose PR890's T21 map with a second PR858 T16 map (replicas 21..36), merge their calls proportionally and apply an eight-role (44,3,2)->(48,1) trade, reaching idle {48:11086,1:6}, the relaxed optimum of PR890's own signed-price bound once the replica cap is lifted. The charged global prefix payload is raised from 512 to 1024 bits (prefix 779, row 17495 < 20161; bootstrap cutoffs recomputed). Gain 2.773066918e-9 over PR890. Co-Authored-By: Claude Opus 5.5 --- .../complex-t37-owners/DEPENDENCY-PINS.json | 38 + research/complex-t37-owners/MANIFEST.json | 20 + research/complex-t37-owners/NOTICE.md | 30 + research/complex-t37-owners/PROOF.md | 95 + research/complex-t37-owners/README.md | 59 + research/complex-t37-owners/build_owners.py | 112 + research/complex-t37-owners/build_parent.py | 131 + research/complex-t37-owners/check_parent.py | 128 + research/complex-t37-owners/common.py | 50 + .../data/ADAPTER-EDITS.json | 219 + research/complex-t37-owners/data/CLAIM.json | 30 + research/complex-t37-owners/data/EDITS.json | 146 + research/complex-t37-owners/data/SPEC.json | 3696 +++++++++++++++++ research/complex-t37-owners/freeze.py | 85 + .../complex-t37-owners/independent_check.py | 314 ++ research/complex-t37-owners/owner_controls.py | 63 + research/complex-t37-owners/price.py | 66 + .../complex-t37-owners/source_adapters.py | 48 + research/complex-t37-owners/verify.py | 244 ++ 19 files changed, 5574 insertions(+) create mode 100644 research/complex-t37-owners/DEPENDENCY-PINS.json create mode 100644 research/complex-t37-owners/MANIFEST.json create mode 100644 research/complex-t37-owners/NOTICE.md create mode 100644 research/complex-t37-owners/PROOF.md create mode 100644 research/complex-t37-owners/README.md create mode 100644 research/complex-t37-owners/build_owners.py create mode 100644 research/complex-t37-owners/build_parent.py create mode 100644 research/complex-t37-owners/check_parent.py create mode 100644 research/complex-t37-owners/common.py create mode 100644 research/complex-t37-owners/data/ADAPTER-EDITS.json create mode 100644 research/complex-t37-owners/data/CLAIM.json create mode 100644 research/complex-t37-owners/data/EDITS.json create mode 100644 research/complex-t37-owners/data/SPEC.json create mode 100644 research/complex-t37-owners/freeze.py create mode 100644 research/complex-t37-owners/independent_check.py create mode 100644 research/complex-t37-owners/owner_controls.py create mode 100644 research/complex-t37-owners/price.py create mode 100644 research/complex-t37-owners/source_adapters.py create mode 100644 research/complex-t37-owners/verify.py diff --git a/research/complex-t37-owners/DEPENDENCY-PINS.json b/research/complex-t37-owners/DEPENDENCY-PINS.json new file mode 100644 index 0000000000..8457dacbc5 --- /dev/null +++ b/research/complex-t37-owners/DEPENDENCY-PINS.json @@ -0,0 +1,38 @@ +{ + "scripts/verify_frontier741.py": "215ee6a12de8dc2392e6811a1b8f2140035f6b2d2a0d2100ff4bd2fdcb8bb39b", + "scripts/verify_frontier741_bindings.py": "eff455167e2fd0bc9a67d35241d0e69d8edc58f3a23e776dcfe8f500ca8e8d67", + "scripts/verify_frontier799.py": "19fe1b32079095160dc00fe2f7df75e0fcbc82cff37f7159b755c8a63bd5ce99", + "scripts/verify_frontier799_bindings.py": "43897b3c99212d6134870898a1840f32898aa1b3679b299e654901568ad7e19b", + "research/complex-sw4-frame8/MANIFEST.json": "b9b39c206fcd2613382b0dcbda23a371e8781d1bedaf8e2f8e7df1e79dc1fa89", + "research/gauge44-frames-x/MANIFEST.json": "e1b7998c8f7cb24f8674d250d0510f2b5b351b2ed0b35f17a17e6bacf3d9824b", + "research/complex-k492-owner-repair/vendor/multicold/code/run_portable.py": "322d29d43dbee8130cde15d4bf05396698b5e3dfe3735813899db91cc0ba7955", + "research/complex-k492-owner-repair/vendor/multicold/engines/moment.py": "81cbc864e106418fc7854322746f72180cb8110ff39f74450a3b8d55a82c1482", + "research/complex-k492-owner-repair/vendor/multicold/engines/base_two_moment.py": "aee70c242a2f1d225528fabe2002e1564d1dc884797c07d28a831c7878ee9098", + "research/complex-k492-owner-repair/vendor/multicold/engines/outer.py": "c1ebb52163a7219504c728a5c2b098bf1e50bf20148a2879c5a74c3cadc7c03c", + "research/community-k492-audit/pr622/replay/baseline558/complex-global/base/split-centres/CANONICAL-WORD.json.gz": "66d3c3c70983224650643a0a05a21ac6c6959f84d0f4528650601016f5a76844", + "research/community-k492-audit/pr622/replay/baseline558/complex-global/base/split-centres/CLIFFORD-RECIPES.json": "534ace870cabe515987e00f50f71550030965006ea18978e0924590ac6944345", + "research/community-k492-audit/pr622/replay/baseline558/complex-global/base/split-centres/CLIFFORD-REVIEW.json": "ee9b86428278392d2c933f76d60e51f5af90d4ab67e4d3937ed2fa416e7755ab", + "research/community-k492-audit/pr622/replay/baseline558/complex-global/base/split-centres/INDEPENDENT-LOCAL-REPLAY.json": "ad3f2b941127688f98ce6872d00f110644f1c2b156f8adad1b6700e838ed0e26", + "research/community-k492-audit/pr622/replay/baseline558/complex-global/base/split-centres/INDEPENDENT-REPLAY.json": "ad3f2b941127688f98ce6872d00f110644f1c2b156f8adad1b6700e838ed0e26", + "research/community-k492-audit/pr622/replay/baseline558/complex-global/base/split-centres/INTEGRATION.json": "5c14538134dfffbc58fa4b4d2f26b270ec5f56d17d4bf23752c82964f45171db", + "research/community-k492-audit/pr622/replay/baseline558/complex-global/base/split-centres/LOCAL-CHECKS.json": "79177449e404403964ce1b2f4a9a8bd49e1916daba3123d7fd7f5cfd1f1ac0ea", + "research/community-k492-audit/pr622/replay/baseline558/complex-global/base/split-centres/LOCAL-PROGRAMS.json.gz": "99a18eede965accf65943e490b8d2b2ffb9f1c9bc6babdb825413a80cbea2cde", + "research/community-k492-audit/pr622/replay/baseline558/complex-global/base/split-centres/RESIDUAL-ADAPTERS.json": "baafef737acc16dafbe1150896feb16744f3d669fa123bb2bff19ecc4e71b275", + "research/community-k492-audit/pr622/replay/baseline558/complex-global/base/split-centres/SCALAR-FRAME-AUDIT.json": "73b3601a6239502475a272ea0c46945fd42034486aaf43e66a212eb4f012ca44", + "research/community-k492-audit/pr622/replay/baseline558/complex-global/base/split-centres/WRAPPER-CHECKS.json": "9a09146e686c4f535b04fdef3753fe01dad8f5e8881a69408a91394acb5b48f5", + "research/community-k492-audit/pr622/replay/baseline558/complex-global/base/work/complex-nine-native/DATA-PHASES.json": "c5916ff312678f12aba403847643fbbc29f643acec60bdf836fa56cd3e8251fa", + "research/complex-k492-owner-repair/vendor/multicold/inputs/PR543-EXPECTED.json": "06eccee9f6b77e140833df83407e7996dc948c17d49b0779ab171fbe463fd28d", + "research/complex-k492-owner-repair/vendor/multicold/vendor/pr558/vendor/pr552/complex-global/vendor531/evidence/audit/PREFIX-AND-INVOICE.json": "ce1bfa49be88ae67a404f606a11db2232b7e1f2610d4418058e39749d86d8478", + "research/complex-k492-owner-repair/vendor/multicold/vendor/pr558/vendor/pr552/complex-global/vendor535/inputs/ROUND20-PARENT-TEMPLATE.json.gz": "025448abdf2012d327e50a009084e1501690d05e650300d2982836aa0350ae00", + "research/community-k492-audit/pr622/replay/baseline558/complex-global/controller-input/split-centres/CANONICAL-WORD.json.gz": "de2be0f4b6d24ace368fd5b834b7a00f9625d0a1824c4ff969f2db5f115db667", + "research/complex-k492-owner-repair/vendor/multicold/vendor/pr558/vendor/pr552/complex-global/vendor531/code/prepare_supplier_base.py": "f5eae94aca965d0008bc07cff8245ccb7509042ccad457d3bcb7d51c1e9409f0", + "research/gauge44-frames-x/data/PLAN.json": "5f40e7ccfca61f298539b4f41286d2a9d62caf947057f9cec82aa53f73f707fd", + "research/gauge44-frames-x/data/OWNERS.json.gz": "99d1c4caf85855c353d30f122d9efbd9e51562914facded13027f347b18a6082", + "research/complex-t21-owners/build_owners.py": "d1e6bbab8ea0de09048fc9737dd4a4713289ca69328efe71855e16fc55abfa57", + "research/complex-t21-owners/common.py": "41a2e8a4cc69251e7e31dd82b4776ccfe46033afa8dca59f45f5d3c377541ea7", + "research/complex-t21-owners/independent_check.py": "9d8c86bf45cdaef37f223c88704055ced503ee295645611e13f3fb9059a00e55", + "research/complex-t21-owners/VENDOR-PINS.json": "578100c9ed4812a161271a1b5c8036673f4b27d6cc1df560715ff2ea9a598f6d", + "research/complex-t21-owners/MANIFEST.json": "663a4300ec3abe2278ac6c8e49dd13dc58694c33bfadaa278c5406539e113a31", + "research/complex-t21-owners/data/T5-OWNERS.json.gz": "676e91f0ab18bdc93b3da067082506b779969dde32a38baacfc8576c327a3c54", + "research/complex-t21-owners/data/EDITS.json": "a3bdecb4899af794427458eec0b7b13b404e2c822c1e8e152d4a4eb92cb10638" +} \ No newline at end of file diff --git a/research/complex-t37-owners/MANIFEST.json b/research/complex-t37-owners/MANIFEST.json new file mode 100644 index 0000000000..3c4e26613b --- /dev/null +++ b/research/complex-t37-owners/MANIFEST.json @@ -0,0 +1,20 @@ +{ + "DEPENDENCY-PINS.json": "8ce67d5bdb1ae2643908606d6123a05f12df4c547e1c78366b9ee724d9e037c0", + "NOTICE.md": "ae6f2c4c31c5a9ec0433bc13d16522e195397eb5081552c54870f61d1700a0fb", + "PROOF.md": "46ef4ec5e2e2727928e89dfd95ae018a26c9a6d75371fdd5c26ed976e62aba3f", + "README.md": "ed58a37440fc10a84baa27ec3d460d3da68bdb34bcaf7dca5b8adf46d4642645", + "build_owners.py": "fd0f0a24c34f8927890038e12c375642ad91e5d1ae28bfaea50b60b53e3339a3", + "build_parent.py": "f86610b5ba77144980257d1e2a3addf6a4bdfad2cfdc72fb99d22765fbae6ebc", + "check_parent.py": "56e923ba05ddab3414a531e2d8455f8fe04e03c60f0d0c707cd42e3a3383924f", + "common.py": "41a2e8a4cc69251e7e31dd82b4776ccfe46033afa8dca59f45f5d3c377541ea7", + "data/ADAPTER-EDITS.json": "82f4efc903789dcfd046e7bd26e72a9a5904cf909f03edd1e8812a2bfc990211", + "data/CLAIM.json": "e610d96b7ec0a79aefe5b31e424710715497fae326672ea3eec73ddda37895eb", + "data/EDITS.json": "43923636f076bda0c6c9087dee6b0bd3118b79d7317306de563a8ffc52567ff9", + "data/SPEC.json": "9dbaac1043821ece044f6aac9afb531c52d38fcb2367f31c2c8eacd4d455a19c", + "freeze.py": "154667b513a640bd96ca91da58bc065fd31dabaab109452e38812935cbaf54de", + "independent_check.py": "07216c2d7d6e46f08af649c1f30c8fe1fcd48a35257291ae9548358726ca61bb", + "owner_controls.py": "2241e3958b732f5cc03a24b7d972e942b036ef324d8c99a5002f6afe00136fe9", + "price.py": "af05621b2232ce22e2dda0c4d610e4606c7d584ae439b081df9a842ac4402f90", + "source_adapters.py": "2423752102e0b4c0e8d329586868cfe55869682e76cc392decc3f99273d320f7", + "verify.py": "f52c1a9f8e69a52113efc2003ab7fb37769bb5e1e38f17a8222cab6a69fb1fc5" +} \ No newline at end of file diff --git a/research/complex-t37-owners/NOTICE.md b/research/complex-t37-owners/NOTICE.md new file mode 100644 index 0000000000..da1a493169 --- /dev/null +++ b/research/complex-t37-owners/NOTICE.md @@ -0,0 +1,30 @@ +# Attribution and source boundaries + +Prepared for Joel Pulikkan (GamingPuzzled) with Claude Opus 5.5 (Anthropic) +assistance via Claude Code, Apache-2.0. + +- New in this package: the observation that PR890's fixed-family bound becomes + replica-unbounded once the charged prefix payload is raised (its row cost is + explicit), the T37 = T21 + T16 composition and proportional merge, the + eight-role (44,3,2) -> (48,1) trade, the 8+8+8+8+5 bank lift and its audit, + the 1024-bit charged-prefix adaptation, and the strict T37 composition. +- Chafik Boukhalfa (chafreaky), PR890: the T21 owner map (T5 witness, T16+T5 + interleaving, nine-role trade), 8+8+5 bank lift, independent checks, owner + bound (whose signed-price relaxation identifies T37's target profile) and the + verification driver this package adapts. Used unchanged from + `research/complex-t21-owners` by path and hash pin. +- Hao Yan (@FanPUYen), PR858: T16 duplication and eleven-role correction, + physical source-event windows, independent owner/chart audit and the + replication-parameterization approach. Its constructor is used unchanged + (twice: inside T21 and as the second T16 component). +- PR869/PR870: the unchanged U8 local word, builder and controller chain + (NewBArch triangle-hybrid B; ColdWitness/icekylinx driver), vendored in PR890. +- Jeremy Kothe's PR799, Chafik Boukhalfa's PR741, the gauge44/PR645, PR635, + PR514/PR484/PR507 controller lineage and the PR589 bit supplier remain + dependencies, covered by the ancestral replay. PR795's signed dual (Chafik + Boukhalfa) is the relaxation used to locate the T37 optimum. + +`DEPENDENCY-PINS.json` pins every PR890 and repository file read by path. +`data/ADAPTER-EDITS.json` lists every literal source edit applied to PR890's +vendored PR870 code with its required multiplicity. `MANIFEST.json` binds this +package. diff --git a/research/complex-t37-owners/PROOF.md b/research/complex-t37-owners/PROOF.md new file mode 100644 index 0000000000..8a7321b748 --- /dev/null +++ b/research/complex-t37-owners/PROOF.md @@ -0,0 +1,95 @@ +# The T37 owner composition + +## What changes, and what does not + +The complex local supplier (PR869/PR870 U8 word: paid profile +`{1:2548,2:338,3:446,4:162,5:72,8:8}`, helper widths +`{4:80,5:32,7:54,8:122,9:216}`), the PR589 bit supplier, both rational moment +engines and the seven-step outer recipe are PR890's, unchanged. Only the +replica count, the whole-owner map and one charged finite constant change. + +## Why PR890's bound stops at T21 + +PR890's exhaustive relaxation (PR795 signed dual) is stated for +`T <= 22`, because the retained prefix charge is `113+18T < 512`. The 512 is +the *charged* global prefix payload. In the inherited finite invoice it is +paid in exactly two places: the prefix reserve `prefix < payload` and the +physical row coefficient `row = 2*bitlen(stock)+9909+252+2*payload < 20161`; +the outer bootstrap additionally checks finite cutoffs `cut*gap >= 2*(4+payload)`. +None of the moment, deficit or 47 outer inequalities depends on it (the outer +row gap uses the retained bound 20161, not the actual row). Charging +`payload = 1024` costs `row = 17495 < 20161` and leaves every other inequality +unchanged; the bootstrap cutoffs are recomputed at `2*(4+1024)`. The retained +PR531 invoice is still required to have been charged at 512 and its allowance +is retained in full, as before. Precedent: earlier packages raised other +charged allocations (192 -> 256) after recomputing their reserves. + +## The relaxed optimum over all T + +Running PR890's own relaxation without the `T <= 22` cap (same dual, same +price table): per replica the excess over all-48 is mass `30 (mod 48)` and +signed credit `150`. Rank-one remainders have the best credit per cost +(credit 925). Six rank-one remainders give credit `5550 = 150*37` and mass +`6 = 30*37 (mod 48)`, so T37 with idle `{48:11086, 1:6}` meets the dual with +equality and is the unique-shape normalized optimum for every T (multiples of +37 repeat it). Its normalized penalty `6c(1)/37` is below T21's +`(3c(1)+c(3))/21`. + +## Construction + +1. PR890's T21 map (PR858 T16 + literal T5 + nine edits) is rebuilt by its own + unchanged constructor; its own independent checker is rerun on it. +2. PR858's T16 map is rebuilt unchanged and relabelled into replicas 21..36 + (replica, owner, copy and family offsets `+21`, `+21*112`, `+21*896`). +3. The 189 T21 calls and 144 T16 calls are merged by the key `(i+1)/189` + versus `(j+1)/144` (ties: T21 first). Each component keeps its own order, + so every component role keeps its window. +4. Before the trade the idle profile is `{48:11085,44:1,3:1,2:1,1:5}`, which + is worse than T21. Eight frozen edits (`data/EDITS.json`) apply the + credit-neutral trade `(44,3,2) -> (48,1)`: + - the lone width-4 role of the cap-48 bin (owner 29, child 8, port 0) + moves into a full bin of owner 20; the width-4 role it displaces (a later + T21 call) moves on to bin (20,14,111); + - bins (20,14,111) and (27,15,0) (fills 29 and 30) are repacked as + `{8,4,4,4,4,4,4} = 32` and `{9,9,9,4} = 31`, moving one width-9 role + (T21 call) into owner 27 and two width-4 roles (second-T16 calls) into + owner 20. + All moves are cross-component, so no moved role is hosted by its own + replica. The result is `{48:11086, 1:6}`. + +## Checks + +The independent checker (PR858/PR890 code, `T = 37`, payload 1024) checks all +`333*504 = 167832` roles against the actual source-event windows, families, +per-call distinctness, whole widths, contiguous slices, all 73-axis charts, +exact per-replica projections, idle profile, deficit `320*37 = 11840`, +prefix `72+37+333+333+4 = 779 < 1024`, row `17495 < 20161` and halving. +Every omitted edit is rejected, and so is the same map under the sequential +(non-interleaved) schedule. The partial bank envelope 8+8+8+8+5 is audited +literally with eight mutations. The PR870 controller chain (bind, emit, +asynchronous audit with mutations, invoice, assembly, 69 admission and 12 bit +controls) runs with cardinality edits and the payload edits listed in +`data/ADAPTER-EDITS.json`. + +## Price + +Live `33152`, rank mass `73*33152-11840 = 2408256`. Both engines certify + +``` +b = 1664727258740678855772 / 10^24 +``` + +(accept at b, reject b+10^-24); bit `c` unchanged. The outer recipe gives + +``` +kappa = 1661960547713947 / 10^18 = 0.001661960547713947 +``` + +which is `2.773066918e-9` above PR890. + +## Scope + +Inherited hypotheses are unchanged (all-size compiler, common-label/mutable +source realization, whole-call hosting, precision/tape, analytic transfer, bit +H1-H5). The new explicit premise is that the charged global prefix payload is +a finite constant priced only through the reserves listed above. diff --git a/research/complex-t37-owners/README.md b/research/complex-t37-owners/README.md new file mode 100644 index 0000000000..80829a632a --- /dev/null +++ b/research/complex-t37-owners/README.md @@ -0,0 +1,59 @@ +# Thirty-seven replicas on the U8 word + +The retained conditional framework admits + +``` +kappa = 1661960547713947 / 10^18 = 0.001661960547713947 +``` + +This is **2.773066918e-9 above PR890** (0.001661957774647029). The U8 local +word, its 504 helper widths, the PR589 bit supplier, both moment engines and the +outer recipe are unchanged. The owner map has **37 replicas, 333 complete calls +and 167,832 whole-helper roles**; its idle profile is `{48:11086, 1:6}`. + +## Idea + +PR890 proves that no replica count `T <= 22` or whole-owner placement improves +T21 for this word. The cap `T <= 22` comes only from the charged 512-bit global +prefix payload (`113+18T < 512`). That payload is a finite constant paid in the +invoice's row reserve (`2*payload`), the prefix reserve and the bootstrap +cutoffs; the moments and the 47 outer inequalities do not see it. This package +charges **1024 bits** (row coefficient `17495 < 20161`, prefix `779 < 1024`). + +Rerunning PR890's own signed-price relaxation without the cap shows that +`{48:11086, 1:6}` at T37 attains the dual with equality and is the best +normalized profile for every replica count. It is constructed as PR890's T21 +plus a second PR858 T16 (replicas 21..36), merged proportionally, plus an +eight-role credit-neutral trade `(44,3,2) -> (48,1)`. See [PROOF.md](PROOF.md). + +## Reproduce + +From the repository root, with Python 3.11+ and the existing frontier replay's +NumPy/SymPy/SciPy, C++17 and Boost dependencies (set `CPATH` to the Boost +include directory if needed): + +```sh +python -B research/complex-t37-owners/verify.py --work /tmp/t37-cold +``` + +It rebuilds PR589, PR741 and PR799, rebuilds U8 and its controls, constructs +T37 (rerunning PR890's T21 and PR858's T16 constructors and audits), lifts the +8+8+8+8+5 bank envelope and audits it with eight mutations, runs PR890's +unchanged independent checker on the T21 component and the T37-parameterized +checker on all roles, rejects all eight omitted edits and the sequential +schedule, then runs bind, emit, asynchronous audit (15 mutations), invoice, +assembly, 69 admission and 12 bit-supplier controls and two exact moment +engines with all 47 outer inequalities. No optimizer runs. Reuse of a verified +PR799 replay works as in PR890 (`--baseline799 DIR --ancestor741 DIR/ancestor`). + +`freeze.py` is the discovery path used once to write `data/SPEC.json`; it is not +a verification premise. + +## Scope + +Finite conditional witness. All-size compilation, common-label and +mutable-source realization, whole-call hosting, precision/tape, analytic +transfer and bit H1-H5 remain inherited hypotheses. The explicit new premise is +the 1024-bit charged prefix payload, priced through the reserves above. Not an +unconditional multiplication theorem or an optimality claim beyond the +relaxation stated in PROOF.md. diff --git a/research/complex-t37-owners/build_owners.py b/research/complex-t37-owners/build_owners.py new file mode 100644 index 0000000000..3acd67a9c5 --- /dev/null +++ b/research/complex-t37-owners/build_owners.py @@ -0,0 +1,112 @@ +# SPDX-License-Identifier: Apache-2.0 +"""Build T37: the unchanged PR890 T21 map, a second PR858 T16 map, eight edits. + +PR890's T21 constructor (PR858 T16 + literal T5 + nine edits) and Hao Yan's +PR858 T16 constructor are imported unchanged from the repository and their own +audits run first. The second T16 copy is relabelled into replicas 21..36. The +two call sequences are merged proportionally, preserving each one's own order. +Eight frozen whole-role edits then concentrate the four non-48 remainders +(44,3,2 plus the existing ones) into six rank-one children. No optimizer runs. +All roles and windows are independently checked by independent_check.py. +""" +import argparse +import copy +from fractions import Fraction +from pathlib import Path +from common import HERE, ROOT, read, require, sha, identity, dump, write_gzip, load + +T21_PACKAGE = ROOT/'research/complex-t21-owners' +SECOND = 21 + + +def relabel(roles, shift): + out = [] + for old in roles: + role = dict(old) + for key in ('replica', 'owner_replica'): + role[key] += shift + role['copy'] += shift*112 + role['family'] += shift*896 + out.append(role) + return out + + +def merged_order(first, second): + """Stable proportional merge: call i of `first` has key (i+1)/len(first), + call j of `second` has key (j+1)/len(second); ties keep `first` earlier.""" + keyed = [(Fraction(i+1, len(first)), 0, tuple(c)) for i, c in enumerate(first)] + keyed += [(Fraction(j+1, len(second)), 1, tuple(c)) for j, c in enumerate(second)] + return [list(c) for _, _, c in sorted(keyed)] + + +def location(role): + return {k: role[k] for k in ('owner_replica', 'child', 'port', 'offset')} + + +def move(role, destination, plan): + role.update(destination) + r, child, port = (role[k] for k in ('owner_replica', 'child', 'port')) + role['copy'] = r*112+port + role['family'] = r*896+(2*plan['pairs'][str(child)]+plan['sides'][str(child)])*112+port + + +def unedited(source_plan, source_owners): + """T21 + relabelled T16 and the merged 333-call order, before the eight edits.""" + t21_builder = load(T21_PACKAGE/'build_owners.py', 'unchanged_pr890_t21_owners') + # Its shared `common` import resolves to this package; bind its own data root. + t21_builder.HERE = T21_PACKAGE + t21, t21_order, t21_details = t21_builder.construct(source_plan, source_owners) + require(len(t21) == 189*504 and len(t21_order) == 189, 'Inherited T21 inventory') + t16_builder = load(T21_PACKAGE/'vendor/pr870/t16/build_owners.py', 'unchanged_pr858_t16_owners') + plan, source = read(source_plan), read(source_owners) + t16 = t16_builder.construct(source, plan) + require(t16_builder.audit(t16, plan) == {1: 2, 2: 1, 44: 1, 48: 4793}, 'Inherited T16 audit') + t16_order = [[s, r+8*g] for s, r in plan['order'] for g in range(2)] + second = relabel(t16, SECOND) + order = merged_order(t21_order, [[s, r+SECOND] for s, r in t16_order]) + at = {tuple(key): time for time, key in enumerate(order)} + require(len(at) == 333 and set(at) == {(s, r) for s in range(9) for r in range(37)}, 'T37 invocation inventory') + roles = copy.deepcopy(t21)+second + for role in roles: + role['time'] = at[role['stage'], role['replica']] + roles.sort(key=lambda r: (r['time'], r['helper'])) + return roles, order, plan, t21, dict(t21_construction=dict(changed_roles=t21_details['changed_roles'], + t16_content_sha256=t21_details['t16_content_sha256'], + t5_content_sha256=t21_details['t5_content_sha256']), + t21_content_sha256=identity(t21), second_t16_content_sha256=identity(t16)) + + +def construct(source_plan, source_owners, edits=None): + roles, order, plan, t21, details = unedited(source_plan, source_owners) + before = copy.deepcopy(roles) + bykey = {(r['time'], r['helper']): r for r in roles} + require(len(bykey) == 333*504, 'Joined role identities') + edits = read(HERE/'data/EDITS.json') if edits is None else edits + for edit in edits: + role = bykey[tuple(edit['role'])] + require(location(role) == edit['before'], 'Frozen edit source location') + move(role, edit['after'], plan) + changed = sum(a != b for a, b in zip(before, roles)) + return roles, order, dict(details, changed_roles=changed), t21 + + +def main(): + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument('--out', type=Path, required=True) + args = parser.parse_args() + require(not args.out.exists(), 'Owner output must be new') + source = ROOT/'research/gauge44-frames-x/data' + roles, order, details, t21 = construct(source/'PLAN.json', source/'OWNERS.json.gz') + require(details['changed_roles'] == 8 == len(read(HERE/'data/EDITS.json')), 'Exactly eight changed roles') + args.out.mkdir(parents=True) + write_gzip(args.out/'OWNERS.json.gz', roles) + # The unchanged PR890 T21 component, for its own inherited independent audit. + write_gzip(args.out/'T21-OWNERS.json.gz', t21) + dump(args.out/'ORDER.json', order) + dump(args.out/'OWNER-CONSTRUCTION.json', dict( + status='PASS_LITERAL_T21_PLUS_T16_EIGHT_ROLE_CONSTRUCTION', roles=len(roles), + owners_sha256=sha(args.out/'OWNERS.json.gz'), owners_content_sha256=identity(roles), **details)) + + +if __name__ == '__main__': + main() diff --git a/research/complex-t37-owners/build_parent.py b/research/complex-t37-owners/build_parent.py new file mode 100644 index 0000000000..c9bd9df4f5 --- /dev/null +++ b/research/complex-t37-owners/build_parent.py @@ -0,0 +1,131 @@ +# SPDX-License-Identifier: Apache-2.0 +"""Construct the 8+8+8+8+5 bank envelope and the bridge-aware T37 plan. + +Extends PR890's 8+8+5 lift of Hao Yan's PR858 two-bank envelope. The last +group has five active residual lanes; its padding is their exact orthogonal +complement. These dedicated banks +are removed from the final hosted controller, not selected recursive children. +""" +import argparse +import copy +from pathlib import Path +from common import HERE, ROOT, read, require, sha, identity, dump, write_gzip, load + +GROUPS = (8, 8, 8, 8, 5) +VENDOR = ROOT/'research/complex-t21-owners/vendor/pr870' + + +def lift(source): + require((source['live'], source['physical']) == (11704, 12218), 'T8 source stock') + data0, bank0, data, live = 7168, 4536, 33152, 55832 + t = copy.deepcopy(source) + t['calls'] = [] + for call in source['calls']: + for group, lanes in enumerate(GROUPS): + if call['replica'] >= lanes: + continue + new = copy.deepcopy(call) + new['replica'] += 8*group + new['owners'] = [[family+data0*group if family < data0 else + data+group*bank0+family-data0, route] + for family, route in new['owners']] + t['calls'].append(new) + for child in t['idle_children']: + require(child['replicas'] == 8, 'T8 idle multiplicity') + child['replicas'] = 37 + for event in t['execution_schedule']: + if 'replicas' in event: + require(event['replicas'] == list(range(8)), 'T8 sweep multiplicity') + event['replicas'] = list(range(37)) + if event['kind'] == 'bank_padding_cover_sweep': + event['families'] = [data, live] + elif event['kind'] == 'translate_every_live_family': + event.update(families=[0, live], charged_calls_per_cover=live) + t['bank_padding']['families'], t['bank_padding']['children'] = [], [] + for group, lanes in enumerate(GROUPS): + for child in source['bank_padding']['children']: + new = copy.deepcopy(child) + new['family'] = data+group*bank0+child['family']-data0 + width, remainder = divmod(73-child['rank'], 8) + require(remainder == 0 and 1 <= width <= 9, 'Dedicated bank residual width') + require(child['axis_indices'] == list(range(8*width, 73)), 'Original complement coordinates') + require(list(map(int, child['orthogonal_axes'])) == + [1 << i for i in child['axis_indices']], 'Original complement axes') + new.update(axis_indices=list(range(lanes*width, 73)), rank=73-lanes*width) + new['orthogonal_axes'] = [1 << i for i in new['axis_indices']] + t['bank_padding']['children'].append(new) + t['bank_padding']['families'].append(new['family']) + t['bank_padding']['semantics'] = ( + 'Each listed coordinate complement acts once after its bank group has ' + 'completed its 8 or 5 disjoint residual lanes. Final hosting removes ' + 'every dedicated bank and padding child.') + t['cover_final_correction'].update(families=[0, live], charged_calls_per_cover=live) + t['private_namespace'] = {key: [live+x-source['live'] for x in interval] + for key, interval in source['private_namespace'].items()} + t.update(live=live, physical=live+514, version='t37-8-8-8-8-5-bank-envelope-v1') + t['route_semantics']['helper'] = ( + 'Bank group floor(replica/8), original lane replica%8. Groups have 8,8,8,8,5 ' + 'active lanes; residual and spectator routes remain literal source routes.') + t['replica_lift'] = dict(groups=list(GROUPS), replicas=37, data_stock=data, + bank_stock=22680, source_template_content_sha256=identity(source), + phase_recipe_unchanged=True) + return t + + +def main(): + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument('--base', type=Path, required=True) + parser.add_argument('--owners', type=Path, required=True) + parser.add_argument('--order', type=Path, required=True) + parser.add_argument('--out', type=Path, required=True) + args = parser.parse_args() + require(not args.out.exists(), 'Lift output must be new') + source = read(args.base/'split-centres/GLOBAL-TEMPLATE.json.gz') + t = lift(source) + original = read(ROOT/'research/gauge44-frames-x/data/PLAN.json') + windows_module = load(VENDOR/'t16/build_parent.py', 'unchanged_physical_windows') + require(windows_module.actual_windows(source, original['order'])[0] == original['windows'], + 'Original T8 physical-window replay') + order, owners = read(args.order), read(args.owners) + windows, schedule = windows_module.actual_windows(t, order) + plan = read(VENDOR/'data/T8/PLAN.json') + profile = {int(k): 333*v for k, v in read(HERE/'data/CLAIM.json')['local_profile'].items()} + for rank, count in ((48, 11086), (1, 6)): + profile[rank] = profile.get(rank, 0)+count + plan.update(T=37, live=33152, deficit=11840, order=order, windows=windows, + profile=dict(sorted(profile.items())), status='FROZEN_EXPLICIT_T37_WHOLE_OWNER_NOMINATION', + mode='gauge44-U8-t37-t21-plus-t16-eight-role-trade', + solver_status='Inherited PR890 T21 and PR858 T16, proportional merge, eight frozen edits; no runtime optimizer') + for field in ('provider_calls', 'per_call_widths'): + bycall = {(c['stage'], c['replica']): c for c in plan[field]} + plan[field] = [] + for time, (stage, replica) in enumerate(order): + call = copy.deepcopy(bycall[stage, replica % 8]) + call['replica'] = replica + if 'time' in call: + call['time'] = time + plan[field].append(call) + plan['assignment_sha256'] = sha(args.owners) + plan['assignment_content_sha256'] = identity(owners) + plan['replica_lift'] = dict(groups=list(GROUPS), source_replicas=8, replicas=37, + parent_template_content_sha256=identity(t), + owners_file_sha256=sha(args.owners), schedule_content_sha256=identity(schedule), + window_semantics='Strict physical source-event intervals, including bridges') + at = {tuple(k): time for time, k in enumerate(order)} + require(len(at) == 333 and len(owners) == 167832, 'T37 invocation/role inventory') + for role in owners: + require(role['time'] == at[role['stage'], role['replica']] and + role['time'] in windows[f"{role['owner_replica']},{role['child']}"][1], + 'Actual source-event owner window') + require(sum(rank*count for rank, count in profile.items()) == 73*33152-11840, 'T37 rank mass') + args.out.mkdir(parents=True) + write_gzip(args.out/'GLOBAL-TEMPLATE.json.gz', t) + dump(args.out/'PLAN.json', plan) + dump(args.out/'PARENT-LIFT.json', dict(status='PASS_T37_BANK_ENVELOPE_AND_PHYSICAL_WINDOWS', + calls=333, checked_roles=len(owners), windows=len(windows), + bank_groups=list(GROUPS), parent_content_sha256=identity(t), + actual_schedule_sha256=identity(schedule))) + + +if __name__ == '__main__': + main() diff --git a/research/complex-t37-owners/check_parent.py b/research/complex-t37-owners/check_parent.py new file mode 100644 index 0000000000..53fbad0cfc --- /dev/null +++ b/research/complex-t37-owners/check_parent.py @@ -0,0 +1,128 @@ +# SPDX-License-Identifier: Apache-2.0 +"""Independent literal audit of T37's 8+8+8+8+5 dedicated-bank envelope. + +No constructor is imported. Every source route, active residual lane, unused +coordinate, private address, data recipe and event multiplicity is checked. +This envelope is an overcharge device; its padding is absent from the final +recursive profile, so padding ranks are not charged as selected children. +""" +import argparse +import copy +from collections import defaultdict +from pathlib import Path +from common import read, require, identity, dump, sha + + +def audit(source, lifted): + require((source['live'], source['physical']) == (11704, 12218), 'Source stock') + require((lifted['live'], lifted['physical']) == (55832, 56346), 'Lifted stock') + old = {(c['stage'], c['replica']): c for c in source['calls']} + calls = {(c['stage'], c['replica']): c for c in lifted['calls']} + require(len(calls) == len(lifted['calls']) == 333 and + set(calls) == {(s, r) for s in range(9) for r in range(37)}, 'Lifted call inventory') + used, counts = defaultdict(set), defaultdict(int) + for (stage, replica), call in calls.items(): + group, lane = divmod(replica, 8) + prior = old[stage, lane] + require({k: v for k, v in call.items() if k not in ('replica', 'owners')} == + {k: v for k, v in prior.items() if k not in ('replica', 'owners')}, 'Literal source call metadata') + require(len(call['owners']) == len(prior['owners']) == 728, 'Owner route count') + require(len({family for family, route in call['owners']}) == 728, 'Per-call family alias') + for index, ((family, route), (old_family, old_route)) in enumerate(zip(call['owners'], prior['owners'])): + expected = old_family+7168*group if index < 224 else 33152+4536*group+old_family-7168 + require(family == expected and route == old_route, 'Literal mapped owner route') + if index < 224: + require(0 <= family < 33152, 'Data namespace') + continue + require(33152 <= family < 55832 and route[0] == 2, 'Dedicated bank namespace') + if len(route) == 2: + require(route[1] == lane, 'Full-width lane') + start, width = 9*lane, 9 + else: + require(len(route) == 4, 'Entering helper route format') + start, width = route[1:3] + require(start == width*lane and 1 <= width < 9, 'Entering residual lane') + cells = set(range(start, start+width)) + require(not used[family] & cells, 'Disjoint active residual lanes') + used[family].update(cells) + counts[family] += 1 + require(set(used) == set(range(33152, 55832)), 'Complete bank family inventory') + padding = lifted['bank_padding'] + require(padding['families'] == list(range(33152, 55832)), 'Padding family namespace') + children = {c['family']: c for c in padding['children']} + require(len(children) == len(padding['children']) == 22680 and set(children) == set(used), 'Padding child inventory') + for family, cells in used.items(): + group = (family-33152)//4536 + require(counts[family] == (8, 8, 8, 8, 5)[group], 'Active lane multiplicity') + unused = sorted(set(range(73))-cells) + child = children[family] + require(child['axis_indices'] == unused and child['rank'] == len(unused) and + list(map(int, child['orthogonal_axes'])) == [1 << i for i in unused], 'Exact residual complement') + require(cells == set(range(len(cells))), 'Residual lanes form coordinate prefix') + require(len(lifted['idle_children']) == len(source['idle_children']) == 2016, 'Data idle inventory') + for old_child, child in zip(source['idle_children'], lifted['idle_children']): + require(old_child['replicas'] == 8 and child == dict(old_child, replicas=37), 'Data idle multiplicity') + require(lifted['recipe'] == source['recipe'] and lifted['local_programs'] == source['local_programs'], 'Original data recipe and local programs') + require(len(lifted['execution_schedule']) == len(source['execution_schedule']) == 32, 'Original event count') + for before, event in zip(source['execution_schedule'], lifted['execution_schedule']): + expected = copy.deepcopy(before) + if 'replicas' in expected: + require(expected['replicas'] == list(range(8)), 'Original event multiplicity') + expected['replicas'] = list(range(37)) + if expected['kind'] == 'bank_padding_cover_sweep': + expected['families'] = [33152, 55832] + elif expected['kind'] == 'translate_every_live_family': + expected.update(families=[0, 55832], charged_calls_per_cover=55832) + require(event == expected, 'Lifted source-event semantics') + require(lifted['cover_final_correction'] == dict(source['cover_final_correction'], + families=[0, 55832], charged_calls_per_cover=55832), 'Final correction namespace') + require(lifted['private_namespace'] == {k: [x+44128 for x in v] + for k, v in source['private_namespace'].items()}, 'Private namespace translation') + changed = {'version', 'live', 'physical', 'calls', 'idle_children', 'execution_schedule', + 'bank_padding', 'cover_final_correction', 'private_namespace', 'route_semantics', 'replica_lift'} + require({k: v for k, v in lifted.items() if k not in changed} == + {k: v for k, v in source.items() if k not in changed}, 'No unapproved parent fields') + require({k: v for k, v in lifted['route_semantics'].items() if k != 'helper'} == + {k: v for k, v in source['route_semantics'].items() if k != 'helper'}, 'Non-helper route semantics') + return dict(status='PASS_INDEPENDENT_T37_PARTIAL_BANK_ENVELOPE', calls=333, + active_helper_lanes=sum(counts.values()), bank_families=len(used), + maximum_auxiliary_padding_rank=max(c['rank'] for c in children.values()), + source_content_sha256=identity(source), parent_content_sha256=identity(lifted)) + + +def controls(source, parent): + mutations = [ + ('missing_fifth_lane', lambda t: t['calls'].pop()), + ('bank_group_alias', lambda t: t['calls'][2]['owners'][224].__setitem__(0, t['calls'][0]['owners'][224][0])), + ('missing_complement_axis', lambda t: t['bank_padding']['children'][-1]['axis_indices'].pop()), + ('stale_complement_rank', lambda t: t['bank_padding']['children'][-1].__setitem__('rank', 1)), + ('old_idle_multiplicity', lambda t: t['idle_children'][0].__setitem__('replicas', 16)), + ('missing_sweep_replica', lambda t: t['execution_schedule'][0]['replicas'].pop()), + ('private_alias', lambda t: t['private_namespace']['centers'].__setitem__(0, 33152)), + ('short_final_correction', lambda t: t['cover_final_correction'].__setitem__('families', [0, 33152])), + ] + rejected = [] + for name, mutate in mutations: + bad = copy.deepcopy(parent) + mutate(bad) + try: + audit(source, bad) + except ValueError as error: + rejected.append(dict(name=name, reason=str(error))) + else: + raise ValueError('Accepted parent mutation: '+name) + return rejected + + +if __name__ == '__main__': + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument('--source', type=Path, required=True) + parser.add_argument('--parent', type=Path, required=True) + parser.add_argument('--out', type=Path, required=True) + args = parser.parse_args() + source, parent = read(args.source), read(args.parent) + result = audit(source, parent) + result['controls_rejected'] = controls(source, parent) + result['input_sha256'] = dict(source=sha(args.source), parent=sha(args.parent)) + dump(args.out, result) + print(result['status'], 'controls='+str(len(result['controls_rejected']))) diff --git a/research/complex-t37-owners/common.py b/research/complex-t37-owners/common.py new file mode 100644 index 0000000000..680cd4b1a9 --- /dev/null +++ b/research/complex-t37-owners/common.py @@ -0,0 +1,50 @@ +# SPDX-License-Identifier: Apache-2.0 +"""Portable JSON identities and explicit checks for the T21 witness.""" +import gzip +import hashlib +import importlib.util +import json +from pathlib import Path + +HERE = Path(__file__).resolve().parent +ROOT = HERE.parents[1] + + +def require(ok, message): + if not ok: + raise ValueError(message) + + +def read(path): + path = Path(path) + raw = path.read_bytes() + return json.loads(gzip.decompress(raw) if path.suffix == '.gz' else raw) + + +def canonical(value): + return json.dumps(value, sort_keys=True, separators=(',', ':'), allow_nan=False).encode() + + +def sha(path): + return hashlib.sha256(Path(path).read_bytes()).hexdigest() + + +def identity(value): + return hashlib.sha256(canonical(value)).hexdigest() + + +def dump(path, value): + Path(path).write_bytes((json.dumps(value, indent=2)+'\n').encode()) + + +def write_gzip(path, value): + raw = bytearray(gzip.compress(canonical(value), mtime=0)) + raw[9] = 255 + Path(path).write_bytes(raw) + + +def load(path, name): + spec = importlib.util.spec_from_file_location(name, path) + module = importlib.util.module_from_spec(spec) + spec.loader.exec_module(module) + return module diff --git a/research/complex-t37-owners/data/ADAPTER-EDITS.json b/research/complex-t37-owners/data/ADAPTER-EDITS.json new file mode 100644 index 0000000000..1b77547d77 --- /dev/null +++ b/research/complex-t37-owners/data/ADAPTER-EDITS.json @@ -0,0 +1,219 @@ +{ + "emit_allcold.py": [ + [ + "==144", + "==333", + 3 + ], + [ + ";T=16;", + ";T=37;", + 1 + ], + [ + "==5120", + "==11840", + 1 + ], + [ + "deficit=5120", + "deficit=11840", + 1 + ] + ], + "audit_allcold.py": [ + [ + ";T=16;", + ";T=37;", + 1 + ], + [ + "CALLS=144", + "CALLS=333", + 1 + ], + [ + "==144", + "==333", + 3 + ], + [ + "range(16)", + "range(37)", + 2 + ], + [ + "0<=r<16", + "0<=r<37", + 1 + ], + [ + "0<=e['time']<144", + "0<=e['time']<333", + 1 + ], + [ + "==5120", + "==11840", + 1 + ], + [ + "deficit=5120", + "deficit=11840", + 2 + ], + [ + "invocations=144", + "invocations=333", + 1 + ] + ], + "invoice_allcold.py": [ + [ + "stages,replicas,blocks_per_stream=9,16,4", + "stages,replicas,blocks_per_stream=9,37,4", + 1 + ], + [ + "owners['deficit']==5120", + "owners['deficit']==11840", + 1 + ], + [ + "all 144 invocation and 144 bridge sweeps", + "all 333 invocation and 333 bridge sweeps", + 1 + ], + [ + "used=max(rebased,parent_pervertex); retained=None; payload=512", + "used=max(rebased,parent_pervertex); retained=None; payload=1024", + 1 + ], + [ + "assert previous['compiler']==compiler and previous['charged_prefix_bits']==payload", + "assert previous['compiler']==compiler and previous['charged_prefix_bits']==512=36 and cut*gap>=2*(4+512)", + "ceil(2*(4+1024)/gap));assert cut*gap**2>=36 and cut*gap>=2*(4+1024)", + 1 + ] + ], + "assembly_controls.py": [ + [ + "1 + 37 + 144 + 144 + 4", + "1 + 37 + 333 + 333 + 4", + 1 + ] + ], + "freeze_spec.py": [ + [ + "{'gauge44':144}", + "{'gauge44':333}", + 1 + ] + ] +} \ No newline at end of file diff --git a/research/complex-t37-owners/data/CLAIM.json b/research/complex-t37-owners/data/CLAIM.json new file mode 100644 index 0000000000..c010fdaa6e --- /dev/null +++ b/research/complex-t37-owners/data/CLAIM.json @@ -0,0 +1,30 @@ +{ + "kappa": "1661960547713947/1000000000000000000", + "kappa_decimal": "0.001661960547713947", + "complex_lower": "1664727258740678855772/1000000000000000000000000", + "bit_lower": "1733427039589844234749/1000000000000000000000000", + "replicas": 37, + "calls": 333, + "roles": 167832, + "live": 33152, + "physical": 33666, + "rank_mass": 2408256, + "deficit": 11840, + "prefix_bits": 779, + "row_coefficient": 17495, + "idle": { + "1": 6, + "48": 11086 + }, + "local_profile": { + "1": 2548, + "2": 338, + "3": 446, + "4": 162, + "5": 72, + "8": 8 + }, + "scope": "Conditional finite U8/T37/PR589 composition with the global prefix payload charged at 1024 bits (row reserve 2*1024). All-size compiler, common-label/mutable-source realization, whole-call hosting, precision/tape, analytic transfer and bit H1-H5 remain inherited hypotheses.", + "baseline890_kappa": "1661957774647029/1000000000000000000", + "charged_prefix_bits": 1024 +} \ No newline at end of file diff --git a/research/complex-t37-owners/data/EDITS.json b/research/complex-t37-owners/data/EDITS.json new file mode 100644 index 0000000000..81ff7253fe --- /dev/null +++ b/research/complex-t37-owners/data/EDITS.json @@ -0,0 +1,146 @@ +[ + { + "role": [ + 8, + 5 + ], + "before": { + "owner_replica": 29, + "child": 8, + "port": 0, + "offset": 0 + }, + "after": { + "owner_replica": 4, + "child": 10, + "port": 63, + "offset": 44 + } + }, + { + "role": [ + 315, + 414 + ], + "before": { + "owner_replica": 27, + "child": 15, + "port": 0, + "offset": 26 + }, + "after": { + "owner_replica": 27, + "child": 15, + "port": 0, + "offset": 18 + } + }, + { + "role": [ + 249, + 266 + ], + "before": { + "owner_replica": 20, + "child": 14, + "port": 111, + "offset": 12 + }, + "after": { + "owner_replica": 27, + "child": 15, + "port": 0, + "offset": 22 + } + }, + { + "role": [ + 266, + 193 + ], + "before": { + "owner_replica": 20, + "child": 14, + "port": 111, + "offset": 21 + }, + "after": { + "owner_replica": 20, + "child": 14, + "port": 111, + "offset": 12 + } + }, + { + "role": [ + 314, + 414 + ], + "before": { + "owner_replica": 20, + "child": 14, + "port": 111, + "offset": 25 + }, + "after": { + "owner_replica": 20, + "child": 14, + "port": 111, + "offset": 16 + } + }, + { + "role": [ + 260, + 193 + ], + "before": { + "owner_replica": 27, + "child": 15, + "port": 0, + "offset": 18 + }, + "after": { + "owner_replica": 20, + "child": 14, + "port": 111, + "offset": 20 + } + }, + { + "role": [ + 311, + 414 + ], + "before": { + "owner_replica": 27, + "child": 15, + "port": 0, + "offset": 22 + }, + "after": { + "owner_replica": 20, + "child": 14, + "port": 111, + "offset": 24 + } + }, + { + "role": [ + 228, + 122 + ], + "before": { + "owner_replica": 4, + "child": 10, + "port": 63, + "offset": 44 + }, + "after": { + "owner_replica": 20, + "child": 14, + "port": 111, + "offset": 28 + } + } +] \ No newline at end of file diff --git a/research/complex-t37-owners/data/SPEC.json b/research/complex-t37-owners/data/SPEC.json new file mode 100644 index 0000000000..03a64d1986 --- /dev/null +++ b/research/complex-t37-owners/data/SPEC.json @@ -0,0 +1,3696 @@ +{ + "schema": "witness-spec/1", + "name": "gauge44-U8-t37", + "data": { + "plan_sha256": "08ba86f28cd09a79faa673774da71227c877b09543cff1aa13fd6068fb170924", + "owners_sha256": "d8a5c6f52978a36b0f705ca87a18b917a68c3f3903011894eff748e953ef01ed", + "owners_content_sha256": "79af81b52ee077965e9d6605cc12a3d43e0982451fc4d69d38d5ce81e6cb7644", + "plan_semantic_sha256": "7dfd8d83b4338b22699d101965edbdc046d9938507a358df410f6218e8fbdac7" + }, + "dispatch": [ + [ + 0, + 0, + "gauge44" + ], + [ + 0, + 21, + "gauge44" + ], + [ + 0, + 8, + "gauge44" + ], + [ + 0, + 29, + "gauge44" + ], + [ + 0, + 1, + "gauge44" + ], + [ + 0, + 22, + "gauge44" + ], + [ + 0, + 9, + "gauge44" + ], + [ + 1, + 0, + "gauge44" + ], + [ + 0, + 30, + "gauge44" + ], + [ + 1, + 8, + "gauge44" + ], + [ + 1, + 21, + "gauge44" + ], + [ + 0, + 16, + "gauge44" + ], + [ + 1, + 29, + "gauge44" + ], + [ + 0, + 2, + "gauge44" + ], + [ + 0, + 10, + "gauge44" + ], + [ + 0, + 23, + "gauge44" + ], + [ + 0, + 17, + "gauge44" + ], + [ + 0, + 31, + "gauge44" + ], + [ + 1, + 1, + "gauge44" + ], + [ + 1, + 22, + "gauge44" + ], + [ + 1, + 9, + "gauge44" + ], + [ + 1, + 16, + "gauge44" + ], + [ + 1, + 30, + "gauge44" + ], + [ + 2, + 0, + "gauge44" + ], + [ + 2, + 21, + "gauge44" + ], + [ + 2, + 8, + "gauge44" + ], + [ + 2, + 29, + "gauge44" + ], + [ + 0, + 18, + "gauge44" + ], + [ + 0, + 3, + "gauge44" + ], + [ + 0, + 24, + "gauge44" + ], + [ + 0, + 11, + "gauge44" + ], + [ + 0, + 32, + "gauge44" + ], + [ + 1, + 17, + "gauge44" + ], + [ + 1, + 23, + "gauge44" + ], + [ + 1, + 2, + "gauge44" + ], + [ + 1, + 10, + "gauge44" + ], + [ + 1, + 31, + "gauge44" + ], + [ + 2, + 16, + "gauge44" + ], + [ + 2, + 22, + "gauge44" + ], + [ + 2, + 1, + "gauge44" + ], + [ + 2, + 30, + "gauge44" + ], + [ + 2, + 9, + "gauge44" + ], + [ + 3, + 21, + "gauge44" + ], + [ + 0, + 19, + "gauge44" + ], + [ + 3, + 0, + "gauge44" + ], + [ + 3, + 29, + "gauge44" + ], + [ + 3, + 8, + "gauge44" + ], + [ + 0, + 25, + "gauge44" + ], + [ + 1, + 18, + "gauge44" + ], + [ + 0, + 33, + "gauge44" + ], + [ + 0, + 4, + "gauge44" + ], + [ + 0, + 12, + "gauge44" + ], + [ + 1, + 24, + "gauge44" + ], + [ + 2, + 17, + "gauge44" + ], + [ + 1, + 32, + "gauge44" + ], + [ + 1, + 3, + "gauge44" + ], + [ + 2, + 23, + "gauge44" + ], + [ + 1, + 11, + "gauge44" + ], + [ + 3, + 16, + "gauge44" + ], + [ + 2, + 31, + "gauge44" + ], + [ + 2, + 2, + "gauge44" + ], + [ + 3, + 22, + "gauge44" + ], + [ + 2, + 10, + "gauge44" + ], + [ + 3, + 30, + "gauge44" + ], + [ + 0, + 20, + "gauge44" + ], + [ + 3, + 1, + "gauge44" + ], + [ + 4, + 21, + "gauge44" + ], + [ + 3, + 9, + "gauge44" + ], + [ + 4, + 29, + "gauge44" + ], + [ + 1, + 19, + "gauge44" + ], + [ + 0, + 26, + "gauge44" + ], + [ + 4, + 0, + "gauge44" + ], + [ + 4, + 8, + "gauge44" + ], + [ + 0, + 34, + "gauge44" + ], + [ + 2, + 18, + "gauge44" + ], + [ + 1, + 25, + "gauge44" + ], + [ + 0, + 5, + "gauge44" + ], + [ + 1, + 33, + "gauge44" + ], + [ + 0, + 13, + "gauge44" + ], + [ + 2, + 24, + "gauge44" + ], + [ + 3, + 17, + "gauge44" + ], + [ + 1, + 4, + "gauge44" + ], + [ + 2, + 32, + "gauge44" + ], + [ + 1, + 12, + "gauge44" + ], + [ + 3, + 23, + "gauge44" + ], + [ + 4, + 16, + "gauge44" + ], + [ + 3, + 31, + "gauge44" + ], + [ + 2, + 3, + "gauge44" + ], + [ + 2, + 11, + "gauge44" + ], + [ + 4, + 22, + "gauge44" + ], + [ + 3, + 2, + "gauge44" + ], + [ + 4, + 30, + "gauge44" + ], + [ + 3, + 10, + "gauge44" + ], + [ + 5, + 21, + "gauge44" + ], + [ + 1, + 20, + "gauge44" + ], + [ + 4, + 1, + "gauge44" + ], + [ + 5, + 29, + "gauge44" + ], + [ + 4, + 9, + "gauge44" + ], + [ + 0, + 27, + "gauge44" + ], + [ + 2, + 19, + "gauge44" + ], + [ + 0, + 35, + "gauge44" + ], + [ + 5, + 0, + "gauge44" + ], + [ + 5, + 8, + "gauge44" + ], + [ + 1, + 26, + "gauge44" + ], + [ + 3, + 18, + "gauge44" + ], + [ + 1, + 34, + "gauge44" + ], + [ + 0, + 6, + "gauge44" + ], + [ + 2, + 25, + "gauge44" + ], + [ + 0, + 14, + "gauge44" + ], + [ + 4, + 17, + "gauge44" + ], + [ + 2, + 33, + "gauge44" + ], + [ + 1, + 5, + "gauge44" + ], + [ + 3, + 24, + "gauge44" + ], + [ + 1, + 13, + "gauge44" + ], + [ + 3, + 32, + "gauge44" + ], + [ + 5, + 16, + "gauge44" + ], + [ + 4, + 23, + "gauge44" + ], + [ + 2, + 4, + "gauge44" + ], + [ + 2, + 12, + "gauge44" + ], + [ + 4, + 31, + "gauge44" + ], + [ + 3, + 3, + "gauge44" + ], + [ + 5, + 22, + "gauge44" + ], + [ + 3, + 11, + "gauge44" + ], + [ + 5, + 30, + "gauge44" + ], + [ + 4, + 2, + "gauge44" + ], + [ + 4, + 10, + "gauge44" + ], + [ + 0, + 28, + "gauge44" + ], + [ + 2, + 20, + "gauge44" + ], + [ + 0, + 36, + "gauge44" + ], + [ + 5, + 1, + "gauge44" + ], + [ + 6, + 21, + "gauge44" + ], + [ + 5, + 9, + "gauge44" + ], + [ + 3, + 19, + "gauge44" + ], + [ + 6, + 29, + "gauge44" + ], + [ + 0, + 7, + "gauge44" + ], + [ + 1, + 27, + "gauge44" + ], + [ + 0, + 15, + "gauge44" + ], + [ + 1, + 35, + "gauge44" + ], + [ + 4, + 18, + "gauge44" + ], + [ + 6, + 0, + "gauge44" + ], + [ + 2, + 26, + "gauge44" + ], + [ + 6, + 8, + "gauge44" + ], + [ + 2, + 34, + "gauge44" + ], + [ + 5, + 17, + "gauge44" + ], + [ + 3, + 25, + "gauge44" + ], + [ + 1, + 6, + "gauge44" + ], + [ + 1, + 14, + "gauge44" + ], + [ + 3, + 33, + "gauge44" + ], + [ + 2, + 5, + "gauge44" + ], + [ + 4, + 24, + "gauge44" + ], + [ + 2, + 13, + "gauge44" + ], + [ + 4, + 32, + "gauge44" + ], + [ + 6, + 16, + "gauge44" + ], + [ + 5, + 23, + "gauge44" + ], + [ + 3, + 4, + "gauge44" + ], + [ + 3, + 12, + "gauge44" + ], + [ + 5, + 31, + "gauge44" + ], + [ + 4, + 3, + "gauge44" + ], + [ + 6, + 22, + "gauge44" + ], + [ + 4, + 11, + "gauge44" + ], + [ + 6, + 30, + "gauge44" + ], + [ + 5, + 2, + "gauge44" + ], + [ + 5, + 10, + "gauge44" + ], + [ + 1, + 28, + "gauge44" + ], + [ + 3, + 20, + "gauge44" + ], + [ + 1, + 36, + "gauge44" + ], + [ + 6, + 1, + "gauge44" + ], + [ + 7, + 21, + "gauge44" + ], + [ + 6, + 9, + "gauge44" + ], + [ + 4, + 19, + "gauge44" + ], + [ + 7, + 29, + "gauge44" + ], + [ + 1, + 7, + "gauge44" + ], + [ + 2, + 27, + "gauge44" + ], + [ + 1, + 15, + "gauge44" + ], + [ + 2, + 35, + "gauge44" + ], + [ + 5, + 18, + "gauge44" + ], + [ + 7, + 0, + "gauge44" + ], + [ + 3, + 26, + "gauge44" + ], + [ + 7, + 8, + "gauge44" + ], + [ + 3, + 34, + "gauge44" + ], + [ + 6, + 17, + "gauge44" + ], + [ + 4, + 25, + "gauge44" + ], + [ + 2, + 6, + "gauge44" + ], + [ + 2, + 14, + "gauge44" + ], + [ + 4, + 33, + "gauge44" + ], + [ + 3, + 5, + "gauge44" + ], + [ + 5, + 24, + "gauge44" + ], + [ + 3, + 13, + "gauge44" + ], + [ + 5, + 32, + "gauge44" + ], + [ + 7, + 16, + "gauge44" + ], + [ + 6, + 23, + "gauge44" + ], + [ + 4, + 4, + "gauge44" + ], + [ + 4, + 12, + "gauge44" + ], + [ + 6, + 31, + "gauge44" + ], + [ + 5, + 3, + "gauge44" + ], + [ + 7, + 22, + "gauge44" + ], + [ + 5, + 11, + "gauge44" + ], + [ + 7, + 30, + "gauge44" + ], + [ + 6, + 2, + "gauge44" + ], + [ + 6, + 10, + "gauge44" + ], + [ + 2, + 28, + "gauge44" + ], + [ + 4, + 20, + "gauge44" + ], + [ + 2, + 36, + "gauge44" + ], + [ + 7, + 1, + "gauge44" + ], + [ + 8, + 21, + "gauge44" + ], + [ + 7, + 9, + "gauge44" + ], + [ + 5, + 19, + "gauge44" + ], + [ + 8, + 29, + "gauge44" + ], + [ + 2, + 7, + "gauge44" + ], + [ + 3, + 27, + "gauge44" + ], + [ + 2, + 15, + "gauge44" + ], + [ + 3, + 35, + "gauge44" + ], + [ + 6, + 18, + "gauge44" + ], + [ + 8, + 0, + "gauge44" + ], + [ + 4, + 26, + "gauge44" + ], + [ + 8, + 8, + "gauge44" + ], + [ + 4, + 34, + "gauge44" + ], + [ + 7, + 17, + "gauge44" + ], + [ + 5, + 25, + "gauge44" + ], + [ + 3, + 6, + "gauge44" + ], + [ + 3, + 14, + "gauge44" + ], + [ + 5, + 33, + "gauge44" + ], + [ + 4, + 5, + "gauge44" + ], + [ + 6, + 24, + "gauge44" + ], + [ + 4, + 13, + "gauge44" + ], + [ + 6, + 32, + "gauge44" + ], + [ + 8, + 16, + "gauge44" + ], + [ + 7, + 23, + "gauge44" + ], + [ + 5, + 4, + "gauge44" + ], + [ + 5, + 12, + "gauge44" + ], + [ + 7, + 31, + "gauge44" + ], + [ + 6, + 3, + "gauge44" + ], + [ + 8, + 22, + "gauge44" + ], + [ + 6, + 11, + "gauge44" + ], + [ + 8, + 30, + "gauge44" + ], + [ + 7, + 2, + "gauge44" + ], + [ + 7, + 10, + "gauge44" + ], + [ + 3, + 28, + "gauge44" + ], + [ + 5, + 20, + "gauge44" + ], + [ + 3, + 36, + "gauge44" + ], + [ + 8, + 1, + "gauge44" + ], + [ + 4, + 27, + "gauge44" + ], + [ + 8, + 9, + "gauge44" + ], + [ + 6, + 19, + "gauge44" + ], + [ + 4, + 35, + "gauge44" + ], + [ + 3, + 7, + "gauge44" + ], + [ + 5, + 26, + "gauge44" + ], + [ + 3, + 15, + "gauge44" + ], + [ + 5, + 34, + "gauge44" + ], + [ + 7, + 18, + "gauge44" + ], + [ + 4, + 6, + "gauge44" + ], + [ + 6, + 25, + "gauge44" + ], + [ + 4, + 14, + "gauge44" + ], + [ + 6, + 33, + "gauge44" + ], + [ + 8, + 17, + "gauge44" + ], + [ + 7, + 24, + "gauge44" + ], + [ + 5, + 5, + "gauge44" + ], + [ + 5, + 13, + "gauge44" + ], + [ + 7, + 32, + "gauge44" + ], + [ + 6, + 4, + "gauge44" + ], + [ + 8, + 23, + "gauge44" + ], + [ + 6, + 12, + "gauge44" + ], + [ + 8, + 31, + "gauge44" + ], + [ + 7, + 3, + "gauge44" + ], + [ + 4, + 28, + "gauge44" + ], + [ + 7, + 11, + "gauge44" + ], + [ + 8, + 2, + "gauge44" + ], + [ + 4, + 36, + "gauge44" + ], + [ + 8, + 10, + "gauge44" + ], + [ + 5, + 27, + "gauge44" + ], + [ + 6, + 20, + "gauge44" + ], + [ + 5, + 35, + "gauge44" + ], + [ + 4, + 7, + "gauge44" + ], + [ + 4, + 15, + "gauge44" + ], + [ + 6, + 26, + "gauge44" + ], + [ + 7, + 19, + "gauge44" + ], + [ + 6, + 34, + "gauge44" + ], + [ + 5, + 6, + "gauge44" + ], + [ + 7, + 25, + "gauge44" + ], + [ + 5, + 14, + "gauge44" + ], + [ + 8, + 18, + "gauge44" + ], + [ + 7, + 33, + "gauge44" + ], + [ + 6, + 5, + "gauge44" + ], + [ + 8, + 24, + "gauge44" + ], + [ + 6, + 13, + "gauge44" + ], + [ + 8, + 32, + "gauge44" + ], + [ + 7, + 4, + "gauge44" + ], + [ + 7, + 12, + "gauge44" + ], + [ + 5, + 28, + "gauge44" + ], + [ + 8, + 3, + "gauge44" + ], + [ + 5, + 36, + "gauge44" + ], + [ + 8, + 11, + "gauge44" + ], + [ + 6, + 27, + "gauge44" + ], + [ + 5, + 7, + "gauge44" + ], + [ + 5, + 15, + "gauge44" + ], + [ + 6, + 35, + "gauge44" + ], + [ + 7, + 20, + "gauge44" + ], + [ + 7, + 26, + "gauge44" + ], + [ + 6, + 6, + "gauge44" + ], + [ + 7, + 34, + "gauge44" + ], + [ + 6, + 14, + "gauge44" + ], + [ + 8, + 25, + "gauge44" + ], + [ + 8, + 19, + "gauge44" + ], + [ + 7, + 5, + "gauge44" + ], + [ + 8, + 33, + "gauge44" + ], + [ + 7, + 13, + "gauge44" + ], + [ + 6, + 28, + "gauge44" + ], + [ + 8, + 4, + "gauge44" + ], + [ + 6, + 36, + "gauge44" + ], + [ + 8, + 12, + "gauge44" + ], + [ + 6, + 7, + "gauge44" + ], + [ + 7, + 27, + "gauge44" + ], + [ + 6, + 15, + "gauge44" + ], + [ + 7, + 35, + "gauge44" + ], + [ + 7, + 6, + "gauge44" + ], + [ + 8, + 26, + "gauge44" + ], + [ + 7, + 14, + "gauge44" + ], + [ + 8, + 20, + "gauge44" + ], + [ + 8, + 34, + "gauge44" + ], + [ + 8, + 5, + "gauge44" + ], + [ + 7, + 28, + "gauge44" + ], + [ + 8, + 13, + "gauge44" + ], + [ + 7, + 36, + "gauge44" + ], + [ + 7, + 7, + "gauge44" + ], + [ + 7, + 15, + "gauge44" + ], + [ + 8, + 27, + "gauge44" + ], + [ + 8, + 6, + "gauge44" + ], + [ + 8, + 35, + "gauge44" + ], + [ + 8, + 14, + "gauge44" + ], + [ + 8, + 28, + "gauge44" + ], + [ + 8, + 7, + "gauge44" + ], + [ + 8, + 15, + "gauge44" + ], + [ + 8, + 36, + "gauge44" + ] + ], + "call_order": [ + [ + 0, + 0 + ], + [ + 0, + 21 + ], + [ + 0, + 8 + ], + [ + 0, + 29 + ], + [ + 0, + 1 + ], + [ + 0, + 22 + ], + [ + 0, + 9 + ], + [ + 1, + 0 + ], + [ + 0, + 30 + ], + [ + 1, + 8 + ], + [ + 1, + 21 + ], + [ + 0, + 16 + ], + [ + 1, + 29 + ], + [ + 0, + 2 + ], + [ + 0, + 10 + ], + [ + 0, + 23 + ], + [ + 0, + 17 + ], + [ + 0, + 31 + ], + [ + 1, + 1 + ], + [ + 1, + 22 + ], + [ + 1, + 9 + ], + [ + 1, + 16 + ], + [ + 1, + 30 + ], + [ + 2, + 0 + ], + [ + 2, + 21 + ], + [ + 2, + 8 + ], + [ + 2, + 29 + ], + [ + 0, + 18 + ], + [ + 0, + 3 + ], + [ + 0, + 24 + ], + [ + 0, + 11 + ], + [ + 0, + 32 + ], + [ + 1, + 17 + ], + [ + 1, + 23 + ], + [ + 1, + 2 + ], + [ + 1, + 10 + ], + [ + 1, + 31 + ], + [ + 2, + 16 + ], + [ + 2, + 22 + ], + [ + 2, + 1 + ], + [ + 2, + 30 + ], + [ + 2, + 9 + ], + [ + 3, + 21 + ], + [ + 0, + 19 + ], + [ + 3, + 0 + ], + [ + 3, + 29 + ], + [ + 3, + 8 + ], + [ + 0, + 25 + ], + [ + 1, + 18 + ], + [ + 0, + 33 + ], + [ + 0, + 4 + ], + [ + 0, + 12 + ], + [ + 1, + 24 + ], + [ + 2, + 17 + ], + [ + 1, + 32 + ], + [ + 1, + 3 + ], + [ + 2, + 23 + ], + [ + 1, + 11 + ], + [ + 3, + 16 + ], + [ + 2, + 31 + ], + [ + 2, + 2 + ], + [ + 3, + 22 + ], + [ + 2, + 10 + ], + [ + 3, + 30 + ], + [ + 0, + 20 + ], + [ + 3, + 1 + ], + [ + 4, + 21 + ], + [ + 3, + 9 + ], + [ + 4, + 29 + ], + [ + 1, + 19 + ], + [ + 0, + 26 + ], + [ + 4, + 0 + ], + [ + 4, + 8 + ], + [ + 0, + 34 + ], + [ + 2, + 18 + ], + [ + 1, + 25 + ], + [ + 0, + 5 + ], + [ + 1, + 33 + ], + [ + 0, + 13 + ], + [ + 2, + 24 + ], + [ + 3, + 17 + ], + [ + 1, + 4 + ], + [ + 2, + 32 + ], + [ + 1, + 12 + ], + [ + 3, + 23 + ], + [ + 4, + 16 + ], + [ + 3, + 31 + ], + [ + 2, + 3 + ], + [ + 2, + 11 + ], + [ + 4, + 22 + ], + [ + 3, + 2 + ], + [ + 4, + 30 + ], + [ + 3, + 10 + ], + [ + 5, + 21 + ], + [ + 1, + 20 + ], + [ + 4, + 1 + ], + [ + 5, + 29 + ], + [ + 4, + 9 + ], + [ + 0, + 27 + ], + [ + 2, + 19 + ], + [ + 0, + 35 + ], + [ + 5, + 0 + ], + [ + 5, + 8 + ], + [ + 1, + 26 + ], + [ + 3, + 18 + ], + [ + 1, + 34 + ], + [ + 0, + 6 + ], + [ + 2, + 25 + ], + [ + 0, + 14 + ], + [ + 4, + 17 + ], + [ + 2, + 33 + ], + [ + 1, + 5 + ], + [ + 3, + 24 + ], + [ + 1, + 13 + ], + [ + 3, + 32 + ], + [ + 5, + 16 + ], + [ + 4, + 23 + ], + [ + 2, + 4 + ], + [ + 2, + 12 + ], + [ + 4, + 31 + ], + [ + 3, + 3 + ], + [ + 5, + 22 + ], + [ + 3, + 11 + ], + [ + 5, + 30 + ], + [ + 4, + 2 + ], + [ + 4, + 10 + ], + [ + 0, + 28 + ], + [ + 2, + 20 + ], + [ + 0, + 36 + ], + [ + 5, + 1 + ], + [ + 6, + 21 + ], + [ + 5, + 9 + ], + [ + 3, + 19 + ], + [ + 6, + 29 + ], + [ + 0, + 7 + ], + [ + 1, + 27 + ], + [ + 0, + 15 + ], + [ + 1, + 35 + ], + [ + 4, + 18 + ], + [ + 6, + 0 + ], + [ + 2, + 26 + ], + [ + 6, + 8 + ], + [ + 2, + 34 + ], + [ + 5, + 17 + ], + [ + 3, + 25 + ], + [ + 1, + 6 + ], + [ + 1, + 14 + ], + [ + 3, + 33 + ], + [ + 2, + 5 + ], + [ + 4, + 24 + ], + [ + 2, + 13 + ], + [ + 4, + 32 + ], + [ + 6, + 16 + ], + [ + 5, + 23 + ], + [ + 3, + 4 + ], + [ + 3, + 12 + ], + [ + 5, + 31 + ], + [ + 4, + 3 + ], + [ + 6, + 22 + ], + [ + 4, + 11 + ], + [ + 6, + 30 + ], + [ + 5, + 2 + ], + [ + 5, + 10 + ], + [ + 1, + 28 + ], + [ + 3, + 20 + ], + [ + 1, + 36 + ], + [ + 6, + 1 + ], + [ + 7, + 21 + ], + [ + 6, + 9 + ], + [ + 4, + 19 + ], + [ + 7, + 29 + ], + [ + 1, + 7 + ], + [ + 2, + 27 + ], + [ + 1, + 15 + ], + [ + 2, + 35 + ], + [ + 5, + 18 + ], + [ + 7, + 0 + ], + [ + 3, + 26 + ], + [ + 7, + 8 + ], + [ + 3, + 34 + ], + [ + 6, + 17 + ], + [ + 4, + 25 + ], + [ + 2, + 6 + ], + [ + 2, + 14 + ], + [ + 4, + 33 + ], + [ + 3, + 5 + ], + [ + 5, + 24 + ], + [ + 3, + 13 + ], + [ + 5, + 32 + ], + [ + 7, + 16 + ], + [ + 6, + 23 + ], + [ + 4, + 4 + ], + [ + 4, + 12 + ], + [ + 6, + 31 + ], + [ + 5, + 3 + ], + [ + 7, + 22 + ], + [ + 5, + 11 + ], + [ + 7, + 30 + ], + [ + 6, + 2 + ], + [ + 6, + 10 + ], + [ + 2, + 28 + ], + [ + 4, + 20 + ], + [ + 2, + 36 + ], + [ + 7, + 1 + ], + [ + 8, + 21 + ], + [ + 7, + 9 + ], + [ + 5, + 19 + ], + [ + 8, + 29 + ], + [ + 2, + 7 + ], + [ + 3, + 27 + ], + [ + 2, + 15 + ], + [ + 3, + 35 + ], + [ + 6, + 18 + ], + [ + 8, + 0 + ], + [ + 4, + 26 + ], + [ + 8, + 8 + ], + [ + 4, + 34 + ], + [ + 7, + 17 + ], + [ + 5, + 25 + ], + [ + 3, + 6 + ], + [ + 3, + 14 + ], + [ + 5, + 33 + ], + [ + 4, + 5 + ], + [ + 6, + 24 + ], + [ + 4, + 13 + ], + [ + 6, + 32 + ], + [ + 8, + 16 + ], + [ + 7, + 23 + ], + [ + 5, + 4 + ], + [ + 5, + 12 + ], + [ + 7, + 31 + ], + [ + 6, + 3 + ], + [ + 8, + 22 + ], + [ + 6, + 11 + ], + [ + 8, + 30 + ], + [ + 7, + 2 + ], + [ + 7, + 10 + ], + [ + 3, + 28 + ], + [ + 5, + 20 + ], + [ + 3, + 36 + ], + [ + 8, + 1 + ], + [ + 4, + 27 + ], + [ + 8, + 9 + ], + [ + 6, + 19 + ], + [ + 4, + 35 + ], + [ + 3, + 7 + ], + [ + 5, + 26 + ], + [ + 3, + 15 + ], + [ + 5, + 34 + ], + [ + 7, + 18 + ], + [ + 4, + 6 + ], + [ + 6, + 25 + ], + [ + 4, + 14 + ], + [ + 6, + 33 + ], + [ + 8, + 17 + ], + [ + 7, + 24 + ], + [ + 5, + 5 + ], + [ + 5, + 13 + ], + [ + 7, + 32 + ], + [ + 6, + 4 + ], + [ + 8, + 23 + ], + [ + 6, + 12 + ], + [ + 8, + 31 + ], + [ + 7, + 3 + ], + [ + 4, + 28 + ], + [ + 7, + 11 + ], + [ + 8, + 2 + ], + [ + 4, + 36 + ], + [ + 8, + 10 + ], + [ + 5, + 27 + ], + [ + 6, + 20 + ], + [ + 5, + 35 + ], + [ + 4, + 7 + ], + [ + 4, + 15 + ], + [ + 6, + 26 + ], + [ + 7, + 19 + ], + [ + 6, + 34 + ], + [ + 5, + 6 + ], + [ + 7, + 25 + ], + [ + 5, + 14 + ], + [ + 8, + 18 + ], + [ + 7, + 33 + ], + [ + 6, + 5 + ], + [ + 8, + 24 + ], + [ + 6, + 13 + ], + [ + 8, + 32 + ], + [ + 7, + 4 + ], + [ + 7, + 12 + ], + [ + 5, + 28 + ], + [ + 8, + 3 + ], + [ + 5, + 36 + ], + [ + 8, + 11 + ], + [ + 6, + 27 + ], + [ + 5, + 7 + ], + [ + 5, + 15 + ], + [ + 6, + 35 + ], + [ + 7, + 20 + ], + [ + 7, + 26 + ], + [ + 6, + 6 + ], + [ + 7, + 34 + ], + [ + 6, + 14 + ], + [ + 8, + 25 + ], + [ + 8, + 19 + ], + [ + 7, + 5 + ], + [ + 8, + 33 + ], + [ + 7, + 13 + ], + [ + 6, + 28 + ], + [ + 8, + 4 + ], + [ + 6, + 36 + ], + [ + 8, + 12 + ], + [ + 6, + 7 + ], + [ + 7, + 27 + ], + [ + 6, + 15 + ], + [ + 7, + 35 + ], + [ + 7, + 6 + ], + [ + 8, + 26 + ], + [ + 7, + 14 + ], + [ + 8, + 20 + ], + [ + 8, + 34 + ], + [ + 8, + 5 + ], + [ + 7, + 28 + ], + [ + 8, + 13 + ], + [ + 7, + 36 + ], + [ + 7, + 7 + ], + [ + 7, + 15 + ], + [ + 8, + 27 + ], + [ + 8, + 6 + ], + [ + 8, + 35 + ], + [ + 8, + 14 + ], + [ + 8, + 28 + ], + [ + 8, + 7 + ], + [ + 8, + 15 + ], + [ + 8, + 36 + ] + ], + "width_spot_helpers": [ + 270, + 282, + 294, + 306 + ], + "providers": { + "gauge44": { + "inventory": { + "4": 80, + "5": 32, + "7": 54, + "8": 122, + "9": 216 + }, + "native_negative_controls": 25, + "phase_edges": 2949, + "expected_profile": { + "1": 2548, + "2": 338, + "3": 446, + "4": 162, + "5": 72, + "8": 8 + }, + "artifact_semantic_sha256": { + "CANONICAL-WORD.json.gz": "24db880b7dab31e6af4eec8a1aba1bbbae29cd50d9a7b77cf0e9b571b3e5ae7c", + "LOCAL-PROGRAMS.json.gz": "a073d8d6a561cf5c8148d8b29ae2800bbe3978377c016b549edd7523eb3cf7e5", + "LOCAL-CHECKS.json": "7d703fa7fc26edab2d82d16632084d9c4c252789991568fe86a56307a9b11aaf", + "INDEPENDENT-LOCAL-REPLAY.json": "031db822c0db37326ce4f7d3c9d2fa90835b80c96ebb51a03468370052032c77", + "CLIFFORD-RECIPES.json": "4629507dcbdd516457c001ff8f9dbe750d1a0cbfa5cfa3c6be003d45804ba0c5", + "CLIFFORD-REVIEW.json": "65ff1fcadd3d01047ceca7eb2d93bbd08a32d452ccec827c206aa8ff28e2cd2d", + "RESIDUAL-ADAPTERS.json": "55281b345e902c04c38a6e82a44e2c84467cd1b93198c101d5cb00d8f7bf40fb" + }, + "entering": 216, + "entrance": 408, + "width_digest": "039cd71ed914537041e51b1894ce84f3c3af69c5ea7cf684ca1139a387ebeb42", + "program_hashes": { + "backward": "e4e483b764e9a85f84a04425e57d73ecdcc72eb2e4d97a64f17d9da58fa5ace0", + "forward": "83d65a63f51bd1ce7f3dd4e4d3597311e065b4775796cd87aea3e3a62689047c" + }, + "artifacts": { + "LOCAL-CHECKS.json": "a99aef882cd6f7631127fd8a116ad4bbaed60e3822455d4f846ae0f45b5af575", + "CLIFFORD-RECIPES.json": "4629507dcbdd516457c001ff8f9dbe750d1a0cbfa5cfa3c6be003d45804ba0c5", + "RESIDUAL-ADAPTERS.json": "8b06181f69832da05e3bffab0737598013e20de6f1f48aad43617fbfe62df615" + }, + "complete_contract": { + "local": { + "backward": { + "events": 24415, + "macros": 19213, + "real_component_primitives": 193354, + "prefix_l1": "48299247708521178587951/16", + "prefix_bits": 72, + "coefficient_work_primitive_count": 95513, + "all_exact_columns": 728, + "dirty_helper_columns": 504, + "all_dirty_helper_columns_restored": true, + "private_centres_and_coefficient_work_cleared": true, + "pre_wrappers": 288, + "post_wrappers": 288, + "endpoint_evidence": "Hash-bound fresh INDEPENDENT-LOCAL-REPLAY.json" + }, + "forward": { + "events": 24415, + "macros": 19213, + "real_component_primitives": 193306, + "prefix_l1": "6812058044968180837/256", + "prefix_bits": 55, + "coefficient_work_primitive_count": 95481, + "all_exact_columns": 728, + "dirty_helper_columns": 504, + "all_dirty_helper_columns_restored": true, + "private_centres_and_coefficient_work_cleared": true, + "pre_wrappers": 288, + "post_wrappers": 288, + "endpoint_evidence": "Hash-bound fresh INDEPENDENT-LOCAL-REPLAY.json" + } + }, + "helpers": 504, + "centres": 8, + "v": 112, + "h": 9, + "n": 728, + "entering_helpers": 216, + "entrance_rank": 408, + "terminal_codimension": 350, + "hyperplane_ended_helpers": 126, + "cold_hyperplane_ended_helpers": 72, + "width_inventory": { + "4": 80, + "5": 32, + "7": 54, + "8": 122, + "9": 216 + }, + "widths": [ + 9, + 4, + 9, + 4, + 9, + 4, + 9, + 9, + 9, + 9, + 4, + 9, + 9, + 9, + 9, + 9, + 9, + 4, + 9, + 4, + 9, + 4, + 9, + 9, + 9, + 9, + 4, + 9, + 9, + 9, + 9, + 9, + 9, + 4, + 9, + 4, + 9, + 4, + 9, + 9, + 9, + 9, + 4, + 9, + 9, + 9, + 9, + 9, + 9, + 4, + 9, + 4, + 9, + 4, + 9, + 9, + 9, + 9, + 4, + 9, + 9, + 9, + 9, + 9, + 9, + 4, + 9, + 4, + 9, + 4, + 9, + 9, + 9, + 9, + 4, + 9, + 9, + 9, + 9, + 9, + 9, + 4, + 9, + 4, + 9, + 4, + 9, + 8, + 9, + 9, + 4, + 9, + 9, + 9, + 9, + 9, + 9, + 4, + 9, + 4, + 9, + 4, + 9, + 8, + 9, + 9, + 4, + 9, + 9, + 9, + 9, + 9, + 9, + 4, + 9, + 4, + 9, + 4, + 9, + 9, + 9, + 9, + 4, + 9, + 9, + 9, + 9, + 9, + 9, + 4, + 9, + 4, + 9, + 4, + 9, + 9, + 9, + 9, + 4, + 9, + 9, + 9, + 9, + 9, + 9, + 4, + 9, + 4, + 9, + 4, + 9, + 9, + 9, + 9, + 4, + 9, + 9, + 9, + 9, + 9, + 9, + 4, + 9, + 4, + 9, + 4, + 9, + 9, + 9, + 9, + 4, + 9, + 9, + 9, + 9, + 9, + 9, + 4, + 9, + 4, + 9, + 4, + 9, + 9, + 9, + 9, + 4, + 9, + 9, + 9, + 9, + 9, + 9, + 4, + 9, + 4, + 9, + 4, + 9, + 9, + 9, + 9, + 4, + 9, + 9, + 9, + 9, + 9, + 9, + 4, + 9, + 4, + 9, + 4, + 9, + 9, + 9, + 9, + 4, + 9, + 9, + 9, + 9, + 9, + 7, + 7, + 7, + 7, + 7, + 7, + 7, + 7, + 7, + 7, + 7, + 7, + 7, + 7, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 7, + 7, + 7, + 7, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 7, + 7, + 8, + 8, + 8, + 8, + 8, + 8, + 9, + 9, + 9, + 9, + 9, + 9, + 7, + 7, + 8, + 8, + 8, + 8, + 9, + 9, + 9, + 9, + 9, + 9, + 8, + 8, + 8, + 9, + 8, + 8, + 9, + 9, + 9, + 9, + 8, + 9, + 7, + 7, + 8, + 9, + 8, + 8, + 9, + 9, + 9, + 9, + 8, + 9, + 8, + 8, + 8, + 8, + 8, + 8, + 8, + 8, + 8, + 8, + 9, + 7, + 7, + 7, + 8, + 8, + 8, + 8, + 8, + 8, + 8, + 8, + 9, + 7, + 8, + 8, + 9, + 9, + 9, + 9, + 8, + 8, + 8, + 8, + 7, + 7, + 7, + 7, + 9, + 8, + 9, + 8, + 8, + 8, + 8, + 8, + 7, + 7, + 7, + 7, + 9, + 8, + 9, + 8, + 8, + 8, + 8, + 8, + 7, + 7, + 7, + 7, + 8, + 8, + 8, + 8, + 8, + 8, + 8, + 8, + 7, + 7, + 7, + 7, + 7, + 7, + 7, + 7, + 7, + 7, + 7, + 7, + 7, + 7, + 8, + 8, + 8, + 5, + 8, + 5, + 5, + 5, + 8, + 8, + 8, + 4, + 8, + 4, + 4, + 4, + 8, + 8, + 8, + 4, + 8, + 4, + 4, + 4, + 8, + 8, + 8, + 4, + 8, + 4, + 4, + 4, + 8, + 8, + 8, + 4, + 8, + 4, + 4, + 4, + 8, + 8, + 8, + 4, + 8, + 4, + 4, + 4, + 8, + 8, + 8, + 5, + 8, + 5, + 5, + 5, + 8, + 8, + 8, + 4, + 8, + 4, + 4, + 4, + 8, + 8, + 8, + 5, + 8, + 5, + 5, + 5, + 8, + 8, + 8, + 5, + 8, + 5, + 5, + 5, + 8, + 8, + 8, + 5, + 8, + 5, + 5, + 5, + 8, + 8, + 8, + 5, + 8, + 5, + 5, + 5, + 8, + 8, + 8, + 5, + 8, + 5, + 5, + 5, + 8, + 8, + 8, + 5, + 8, + 5, + 5, + 5 + ], + "local_adapters": 381040, + "local_primitive_bound": 9882019582794, + "compiler": 25934336, + "children": 3574, + "paid_profile": { + "1": 2548, + "2": 338, + "3": 446, + "4": 162, + "5": 72, + "8": 8 + }, + "program_hashes": { + "backward": "e4e483b764e9a85f84a04425e57d73ecdcc72eb2e4d97a64f17d9da58fa5ace0", + "forward": "83d65a63f51bd1ce7f3dd4e4d3597311e065b4775796cd87aea3e3a62689047c" + }, + "semantic_artifact_sha256": { + "CANONICAL-WORD.json.gz": "24db880b7dab31e6af4eec8a1aba1bbbae29cd50d9a7b77cf0e9b571b3e5ae7c", + "LOCAL-PROGRAMS.json.gz": "a073d8d6a561cf5c8148d8b29ae2800bbe3978377c016b549edd7523eb3cf7e5", + "LOCAL-CHECKS.json": "7d703fa7fc26edab2d82d16632084d9c4c252789991568fe86a56307a9b11aaf", + "INDEPENDENT-LOCAL-REPLAY.json": "031db822c0db37326ce4f7d3c9d2fa90835b80c96ebb51a03468370052032c77", + "CLIFFORD-RECIPES.json": "4629507dcbdd516457c001ff8f9dbe750d1a0cbfa5cfa3c6be003d45804ba0c5", + "CLIFFORD-REVIEW.json": "65ff1fcadd3d01047ceca7eb2d93bbd08a32d452ccec827c206aa8ff28e2cd2d", + "RESIDUAL-ADAPTERS.json": "55281b345e902c04c38a6e82a44e2c84467cd1b93198c101d5cb00d8f7bf40fb" + } + }, + "semantic_phase_sha256": "65ff1fcadd3d01047ceca7eb2d93bbd08a32d452ccec827c206aa8ff28e2cd2d", + "expected_local": { + "forward": { + "events": 24415, + "macros": 19213, + "real_component_primitives": 193306, + "prefix_l1": "6812058044968180837/256", + "coefficient_work_primitive_count": 95481 + }, + "backward": { + "events": 24415, + "macros": 19213, + "real_component_primitives": 193354, + "prefix_l1": "48299247708521178587951/16", + "coefficient_work_primitive_count": 95513 + } + }, + "wrappers": 288 + } + }, + "expected": { + "gain_baseline_kappa": "0.001636241501576388", + "assembly_controls_rejected": 69, + "mutations_rejected": 15, + "hosted_residuals": 167832, + "rank_mass": 2408256, + "actual_73column_sigmas": 9630, + "cross_replica_helper_roles": 128905, + "idle_remainders": 11092, + "idle_remainder_profile": { + "1": 6, + "48": 11086 + }, + "global_profile": { + "1": 848490, + "2": 112554, + "3": 148518, + "4": 53946, + "5": 23976, + "8": 2664, + "48": 11086 + }, + "live": 33152, + "physical": 33666, + "conservative_kappa_decimal": "0.00166196054483158", + "kappa_decimal": "0.001661960547713947", + "complex_lower": "416181814685169713943/250000000000000000000000", + "conservative_complex_lower": "1664727255848707292019/1000000000000000000000000", + "kappa": "1661960547713947/1000000000000000000", + "provider_counts": { + "gauge44": 333 + } + }, + "pivot_swap": { + "recipe": "vendor/pr870/construction/layers_np/PIVOT-SWAP-NP.json", + "sha256": "d49b8d316da1cbdaf995dd0e8314d3c67cc9cd4d5902e9d85ccb907be645bef5" + } +} diff --git a/research/complex-t37-owners/freeze.py b/research/complex-t37-owners/freeze.py new file mode 100644 index 0000000000..7ea9315fd7 --- /dev/null +++ b/research/complex-t37-owners/freeze.py @@ -0,0 +1,85 @@ +# SPDX-License-Identifier: Apache-2.0 +"""Freeze path (not a verification premise): rerun the PR870 controller chain in +WITNESS_DISCOVER mode on the T37 owners, record every pinned value, and write +data/SPEC.json. verify.py must then pass strictly against the frozen values. + +Inputs are an existing verified PR799 replay and a fresh U8 native build +(--native, the `native` directory of a cold verify.py or PR890 replay). +""" +import argparse +import copy +import json +import os +import shutil +import subprocess +import sys +from pathlib import Path +from common import HERE, ROOT, read, require, sha, identity, dump + +SOURCE = ROOT/'research/complex-k492-owner-repair/vendor/multicold' +T21 = ROOT/'research/complex-t21-owners' + + +def main(): + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument('--baseline799', type=Path, required=True) + parser.add_argument('--native', type=Path, required=True) + parser.add_argument('--work', type=Path, required=True) + args = parser.parse_args() + work = args.work.resolve() + require(not work.exists(), 'New work directory required') + work.mkdir(parents=True) + env = dict(os.environ, PYTHONDONTWRITEBYTECODE='1', PYTHONUTF8='1', PYTHONINTMAXSTRDIGITS='0', + PYTHON=sys.executable, MULTICOLD_SOURCE=str(SOURCE), GAIN_PR564_SOURCE=str(SOURCE)) + + def run(script, *arguments): + subprocess.run([sys.executable, '-B', str(SOURCE/'code/run_portable.py'), str(script), *map(str, arguments)], + cwd=ROOT, env=env, check=True) + + base = args.baseline799.resolve()/'global/global/base' + local = args.native.resolve()/'local' + run(HERE/'build_owners.py', '--out', work/'owners') + run(HERE/'build_parent.py', '--base', base, '--owners', work/'owners/OWNERS.json.gz', + '--order', work/'owners/ORDER.json', '--out', work/'lift') + run(HERE/'source_adapters.py', work/'runtime') + plan, roles = read(work/'lift/PLAN.json'), read(work/'owners/OWNERS.json.gz') + content = identity(roles) + value = copy.deepcopy(plan) + value['assignment_sha256'] = value['replica_lift']['owners_file_sha256'] = content + spec = read(HERE/'data/SPEC.json') + spec['data'] = dict(plan_sha256=sha(work/'lift/PLAN.json'), owners_sha256=sha(work/'owners/OWNERS.json.gz'), + owners_content_sha256=content, plan_semantic_sha256=identity(value)) + spec['pivot_swap']['recipe'] = str((T21/'vendor/pr870/construction/layers_np/PIVOT-SWAP-NP.json').resolve()) + (work/'runtime/data').mkdir() + dump(work/'runtime/data/SPEC.json', spec) + env.update(WITNESS_SPEC=str(work/'runtime/data/SPEC.json'), WITNESS_DISCOVER='1', + WITNESS_RECORD=str(work/'WITNESS-RECORD.jsonl')) + shutil.copytree(args.baseline799.resolve()/'global/parent558', work/'parent') + shutil.copyfile(work/'lift/GLOBAL-TEMPLATE.json.gz', work/'parent/complex-global/base/split-centres/GLOBAL-TEMPLATE.json.gz') + code, g = work/'runtime/code', work/'global' + run(code/'bind_providers_portable.py', '--baseline', work/'parent', '--provider', 'gauge44='+str(local), '--plan', work/'lift/PLAN.json', '--out', g) + run(code/'emit_allcold.py', '--base', g/'base', '--owners', work/'owners/OWNERS.json.gz', '--plan', g/'PLAN.json', '--out', g/'hosted') + run(code/'audit_allcold.py', g/'base', g/'hosted', g/'audit/ASYNC-AUDIT.json', '--mutation-controls') + run(code/'invoice_allcold.py', '--base', g/'base', '--hosted', g/'hosted', '--audit', g/'audit', '--out', g/'audit', + '--retained-invoice', SOURCE/'vendor/pr558/vendor/pr552/complex-global/vendor531/evidence/audit/PREFIX-AND-INVOICE.json') + run(code/'assemble.py', SOURCE, g, work/'ASSEMBLY.json') + disc = work/'discovery' + disc.mkdir() + shutil.copyfile(work/'WITNESS-RECORD.jsonl', disc/'WITNESS-RECORD.jsonl') + shutil.copyfile(work/'ASSEMBLY.json', disc/'ASSEMBLY.json') + frozen = work/'SPEC-FROZEN.json' + seed = copy.deepcopy(spec) + seed['pivot_swap'] = read(HERE/'data/SPEC.json')['pivot_swap'] + dump(frozen, seed) + subprocess.run([sys.executable, '-B', str(code/'freeze_spec.py'), '--spec', frozen, '--discovery', disc], check=True) + result = read(frozen) + result['data'] = spec['data'] + claim = read(HERE/'data/CLAIM.json') + assembly = read(work/'ASSEMBLY.json') + require(assembly['kappa_decimal'] == claim['kappa_decimal'], 'Discovery reproduces the claimed exponent') + dump(HERE/'data/SPEC.json', result) + print('FROZEN', assembly['kappa_decimal']) + + +if __name__ == '__main__': + main() diff --git a/research/complex-t37-owners/independent_check.py b/research/complex-t37-owners/independent_check.py new file mode 100644 index 0000000000..721e2b62a0 --- /dev/null +++ b/research/complex-t37-owners/independent_check.py @@ -0,0 +1,314 @@ +#!/usr/bin/env python3 +# SPDX-License-Identifier: Apache-2.0 +# Prepared for haoyan with substantial OpenAI Codex assistance. +"""Independent variable-replica event, whole-helper, chart and finite-reserve audit. + +Inputs are read-only. No owner constructor or controller auditor is imported. +--word is the canonical local supplier JSON.gz, with frame IDs and a native +INDEPENDENT-LOCAL-REPLAY.json alongside it (override with --local-replay). +--baseline-parent is the original eight-replica GLOBAL-TEMPLATE.json.gz. +Parameterized from Hao Yan's PR858 checker; the original source is vendored. +Only replica cardinalities, the nominated idle profile, and the two-copy +interleaving restriction change. Exact per-replica source projections remain. +Its sibling CANONICAL-WORD.json.gz supplies ports; DATA-PHASES.json defaults +to ../work/complex-nine-native/DATA-PHASES.json (override with --phases). +The PR741 and PR799/X4 suppliers share this width/owner interface. Their +local paid profiles and prefix exponents are read and recounted from the +provided canonical word and hash-bound native replay, never fixed to PR741. +--out names a JSON receipt. Checks remain enabled under python -O. +""" +import argparse +from collections import Counter, defaultdict +import gzip +import hashlib +import json +from pathlib import Path + +V, H, M, T, R = 112, 9, 73, 37, 504 +# Charged global prefix payload. PR890 and its lineage retained 512 bits; T37 +# needs 779, so 1024 bits are charged and the row reserve below pays 2*1024. +PAYLOAD = 1024 +EXPECTED_IDLE = None + + +def require(condition, message): + if not condition: + raise ValueError(message) + + +def read(path): + data = path.read_bytes() + return json.loads(gzip.decompress(data) if path.suffix == '.gz' else data) + + +def filehash(path): + return hashlib.sha256(path.read_bytes()).hexdigest() + + +def basis(vectors): + pivots = {} + for x in vectors: + require(type(x) is int and 0 <= x < 1 << H, 'invalid local frame vector') + while x: + bit = x.bit_length() - 1 + if bit in pivots: + x ^= pivots[bit] + else: + pivots[bit] = x + break + for bit in sorted(pivots): + for upper in pivots: + if upper > bit and pivots[upper] >> bit & 1: + pivots[upper] ^= pivots[bit] + return tuple(pivots[bit] for bit in sorted(pivots, reverse=True)) + + +def local_inventory(word, replay): + require((word['v'], word['h'], word['R']) == (V, H, R), 'local supplier dimensions') + frames = [basis(frame) for frame in word['frames']] + n = 2 * V + R + require(len(word['start']) == len(word['final']) == n, 'local frame vector lengths') + current = [frames[f] for f in word['start']] + paid = Counter() + + def climb(register, frame): + require(basis(current[register] + frame) == frame, 'nonmonotone local frame') + jump = len(frame) - len(current[register]) + if jump: + paid[jump] += 1 + current[register] = frame + + require(not word['target_levels'], 'this audit requires the current zero-level centre interface') + for section in ('A', 'B', 'tail'): + if section == 'B': + require(all(current[t] == () for t in range(V, 2 * V)), 'target centre level') + for q, frame_id in zip(word['centers'], word['center_frames']): + require(current[q] == frames[frame_id], 'centre carrier frame') + paid[len(frames[frame_id])] += 1 + for gate in word[section]: + registers = gate[1:3] if gate[0] == 'add' else gate[1:2] + require(gate[0] in ('add', 'scale'), 'unknown scalar gate') + for register in registers: + climb(register, frames[gate[-1]]) + for register, frame_id in enumerate(word['final']): + climb(register, frames[frame_id]) + require(dict(paid) == {int(r): count for r, count in word['local_profile'].items()}, 'local paid-profile recount') + for orientation in ('forward', 'backward'): + require(dict(paid) == {int(r): count for r, count in replay['paid_profiles'][orientation].items()}, 'local replay profile binding') + widths = [len(frames[word['final'][q]]) - len(frames[word['start'][q]]) for q in range(2 * V, n)] + require(Counter(widths) == {4: 80, 5: 32, 7: 54, 8: 122, 9: 216}, 'current supplier width inventory') + return widths, paid + + +def make_context(parent, phases, ports, word, replay, roles): + widths, paid = local_inventory(word, replay) + require(len(parent['calls']) == 72 and {(c['stage'], c['replica']) for c in parent['calls']} == {(s, r) for s in range(9) for r in range(8)}, 'original eight-replica baseline calls') + require(len(roles) == 9 * T * R, 'complete helper role count') + address = {} + for role in roles: + key = (role['stage'], role['replica']) + time = role['time'] + require(time not in address or address[time] == key, 'inconsistent invocation time address') + address[time] = key + require(set(address) == set(range(9 * T)), 'contiguous invocation times') + order = [address[t] for t in range(9 * T)] + require(set(order) == {(s, r) for s in range(9) for r in range(T)}, 'stage/replica inventory') + # Arbitrary interleaving: the exact per-replica projection is checked below. + rank = {child['child']: child['rank'] for child in parent['idle_children']} + source = parent['execution_schedule'] + blocks, stage = {}, None + for index, event in enumerate(source): + if event['kind'] in ('bank_padding_cover_sweep', 'translate_every_live_family'): + continue + if event['kind'] == 'local_cover_sweep': + stage = event['stage'] + blocks[stage] = [] + require(stage is not None, 'source event before first invocation') + blocks[stage].append((index, event)) + require(set(blocks) == set(range(9)), 'source stage inventory') + events = [(index, event, replica, time) for time, (stage, replica) in enumerate(order) for index, event in blocks[stage]] + projections = defaultdict(list) + for index, event, replica, time in events: + projections[replica].append(index) + require(set(projections) == set(range(T)) and all(p == list(range(30)) for p in projections.values()), 'per-replica source-event projection') + stage_pair = {e['stage']: e['pair'] for e in parent['recipe'] if e['kind'] == 'local'} + last, windows, callpos, child_pair, side = {}, {}, {}, {}, {} + bridges = 0 + for position, (_, event, replica, _) in enumerate(events): + kind = event['kind'] + if kind == 'local_cover_sweep': + stage = event['stage'] + callpos[stage, replica] = position + last[replica, stage_pair[stage]] = position + elif kind == 'bridge': + last[replica, event['src']] = last[replica, event['dst']] = position + bridges += 1 + elif kind == 'idle_cover_sweep': + for sd, child in enumerate(event['child_indices']): + if child in rank: + windows[replica, child] = (last.get((replica, event['pair']), -1), position) + child_pair[child], side[child] = event['pair'], sd + require(len(windows) == T * len(rank), 'actual window inventory') + require(len(ports) == V, 'port count') + bases = [] + for q in ports: + zero = next(i for i in range(H) if not (q >> i & 1)) + correction = q ^ (1 << zero) + axes = list(range(H)) + axes[0], axes[zero] = axes[zero], axes[0] + frame = [(1 << i) ^ (correction if correction >> i & 1 else 0) for i in axes] + [1 << i for i in range(H, M)] + require(all((x & y).bit_count() % 2 == int(i == j) for i, x in enumerate(frame) for j, y in enumerate(frame)), 'nonorthogonal owner basis') + bases.append(frame) + return dict(widths=widths, paid=paid, order=order, at={key:t for t,key in enumerate(order)}, rank=rank, + windows=windows, callpos=callpos, child_pair=child_pair, side=side, stage_pair=stage_pair, + bases=bases, phases=phases, bridges=bridges, event_count=len(events), replay=replay) + + +def check_roles(context, roles): + c = context + live, physical = T * 8 * V, T * 8 * V + 8 + R + 2 + require(len(roles) == 9 * T * R, 'complete helper role count') + helpers, families, used = defaultdict(set), defaultdict(set), defaultdict(set) + charts, chart_cache = set(), {} + for z in roles: + s, r, helper = z['stage'], z['replica'], z['helper'] + owner, child, port = z['owner_replica'], z['child'], z['port'] + offset, width, family = z['offset'], z['width'], z['family'] + call = (s, r) + require(call in c['at'] and 0 <= helper < R and 0 <= owner < T and 0 <= port < V, 'role coordinates') + require(z['time'] == c['at'][call], 'role invocation time') + require(width == c['widths'][helper], 'whole-helper residual width') + require(0 <= family < live, 'private-namespace collision') + require(child in c['rank'], 'unknown idle child') + require(z['copy'] == V * owner + port and family == owner * 896 + (2 * c['child_pair'][child] + c['side'][child]) * V + port, 'physical family identity') + lo, hi = c['windows'][owner, child] + require(lo < c['callpos'][call] < hi, 'strict bridge-aware idle window') + require(family // 224 != r * 4 + c['stage_pair'][s], 'helper aliases active data pair') + require(helper not in helpers[call] and family not in families[call], 'duplicate helper or family within whole invocation') + helpers[call].add(helper) + families[call].add(family) + cells = set(range(offset, offset + width)) + bin_key = (owner, child, port) + require(offset >= 0 and offset + width <= c['rank'][child] and not used[bin_key] & cells, 'overlapping or out-of-capacity slice') + used[bin_key].update(cells) + chart_key = (port, child, offset, width) + if chart_key not in chart_cache: + frame = c['bases'][port] + pending = list(map(int, c['phases']['recipes'][port]['idle_children'][child]['orthogonal_axes'])) + require(len(pending) == c['rank'][child], 'phase child rank') + occupied = [frame.index(x) for x in pending[offset:offset + width]] + spectators = [i for i in range(M) if i not in occupied][:H - width] + permutation = occupied + spectators + [i for i in range(M) if i not in occupied and i not in spectators] + require(len(occupied) == width and len(set(occupied + spectators)) == H and sorted(permutation) == list(range(M)), 'residual/spectator permutation') + require([frame[i] for i in permutation[:width]] == pending[offset:offset + width], 'pending-axis binding') + chart_cache[chart_key] = tuple(frame[i] for i in permutation) + charts.add(chart_cache[chart_key]) + require(set(helpers) == set(c['order']) and all(h == set(range(R)) for h in helpers.values()), 'complete per-call helper inventory') + idle = Counter() + for owner, child in c['windows']: + for port in range(V): + cells = used[owner, child, port] + require(cells == set(range(len(cells))), 'gap in pending prefix') + left = c['rank'][child] - len(cells) + if left: + idle[left] += 1 + require(dict(idle) == EXPECTED_IDLE, 'nominated idle profile') + profile = Counter({rank: 9 * T * count for rank, count in c['paid'].items()}) + profile.update(idle) + mass = sum(rank * count for rank, count in profile.items()) + require(M * live - mass == 320*T, 'replica-scaled rank deficit') + require(c['bridges'] == 9*T, 'actual bridge count') + localbits = max(x['prefix_bits_upper'] for x in c['replay']['local'].values()) + prefix = localbits + (M + 1) // 2 + len(c['order']) + c['bridges'] + 4 + group = 2 ** (36 * 36) + for i in range(1, 37): + group *= 2 ** (2 * i) - 1 + stock = group * physical + row = 2 * stock.bit_length() + 9909 + 252 + 2 * PAYLOAD + require(prefix < PAYLOAD, 'prefix reserve') + require(row < 20161 and M * M > 2 * max(profile) ** 2, 'row or halving reserve') + return dict(status='PASS_INDEPENDENT_VARIABLE_T_LITERAL_WINDOWS_CHARTS_PREFIX_ROW', roles=len(roles), calls=len(c['order']), + source_events_per_replica=30, expanded_replica_events=c['event_count'], bridge_events=c['bridges'], + literal_windows=len(c['windows']), checked_whole_helper_widths=len(roles), checked_busy_family_windows=len(roles), + orthogonal_port_bases=len(c['bases']), actual_73_axis_charts=len(charts), checked_slice_prefixes=len(c['windows']) * V, + local_profile=dict(sorted(c['paid'].items())), width_inventory=dict(sorted(Counter(c['widths']).items())), + idle=dict(sorted(idle.items())), profile=dict(sorted(profile.items())), live=live, physical=physical, + rank_mass=mass, deficit=320*T, namespace={'data':[0,live], 'centres':[live,live+8], 'tableau':[live+8,live+8+R], 'coefficient':[live+8+R,physical]}, + local_prefix_bits=localbits, local_prefix_from_native_receipt=True, local_profile_recounted=True, + prefix_formula=dict(local_scalar=localbits, input_l2=(M + 1) // 2, invocations=len(c['order']), bridges=c['bridges'], margin=4), + prefix_bits=prefix, charged_prefix_bits=PAYLOAD, physical_stock_bits=stock.bit_length(), + physical_row_coefficient=row, row_limit=20161, + scope='Finite role/window/chart and inherited prefix/row obligations. Requires separately admitted local supplier and emitted controller, complete finite invoice, exact moments and outer assembly; no all-size theorem is asserted.') + + +def controls(context, roles): + candidates = [] + first = roles[0] + bad = dict(first, family=896*T) + candidates.append(('private_namespace_collision', [bad] + roles[1:], 'private-namespace collision')) + index = next(i for i, z in enumerate(roles) if z['replica'] >= 1) + bad = dict(roles[index], replica=roles[index]['replica'] - 1) + candidates.append(('copy_replica_alias', [bad] + roles[:index] + roles[index+1:], 'role invocation time')) + candidates.append(('missing_whole_helper', roles[1:], 'complete helper role count')) + split = dict(first, width=first['width'] - 1) + fragment = dict(first, offset=first['offset'] + first['width'] - 1, width=1) + candidates.append(('split_whole_helper', [split, fragment] + roles[1:], 'complete helper role count')) + candidates.append(('truncated_helper_width', [split] + roles[1:], 'whole-helper residual width')) + # Keep the family and chart valid, but move one complete role past its + # actual idle event. Freeze the original invocation order for controls. + crossing = None + for index, z in enumerate(roles): + lo, hi = context['windows'][z['owner_replica'], z['child']] + later = next((key for key in context['order'] if context['callpos'][key] >= hi), None) + if later is not None: + crossing = [dict(z, stage=later[0], replica=later[1], time=context['at'][later])] + roles[:index] + roles[index+1:] + break + require(crossing is not None, 'no idle-boundary control could be constructed') + candidates.append(('cross_idle_boundary', crossing, 'strict bridge-aware idle window')) + rejected = [] + for name, bad, expected in candidates: + try: + check_roles(context, bad) + except ValueError as exc: + require(str(exc) == expected, 'control rejected at unexpected predicate: ' + name) + rejected.append(dict(name=name, reason=str(exc))) + else: + raise ValueError('accepted negative control: ' + name) + return rejected + + +def main(): + global T, EXPECTED_IDLE + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument('--baseline-parent', type=Path, required=True) + parser.add_argument('--owners', type=Path, required=True) + parser.add_argument('--word', type=Path, required=True) + parser.add_argument('--phases', type=Path) + parser.add_argument('--local-replay', type=Path) + parser.add_argument('--out', type=Path, required=True) + parser.add_argument("--replicas", type=int, required=True) + parser.add_argument("--expected-idle", required=True) + args = parser.parse_args() + T = args.replicas + require(1 <= T <= 37, "replica range") + EXPECTED_IDLE = {int(k): v for k,v in json.loads(args.expected_idle).items()} + phases_path = args.phases or args.baseline_parent.parent.parent / 'work/complex-nine-native/DATA-PHASES.json' + canonical_path = args.baseline_parent.parent / 'CANONICAL-WORD.json.gz' + replay_path = args.local_replay or args.word.parent / 'INDEPENDENT-LOCAL-REPLAY.json' + parent, phases, canonical, word, replay, roles = map(read, (args.baseline_parent, phases_path, canonical_path, args.word, replay_path, args.owners)) + require(replay['status'] == 'PASS_INDEPENDENT_LOCAL_SCALAR_FRAME_AND_WRAPPER_REPLAY', 'local replay status') + require(replay['canonical_word_sha256'] == filehash(args.word), 'local word/replay hash binding') + require(set(replay['local']) == {'forward', 'backward'}, 'both native prefix orientations') + require(word['ports'] == canonical['ports'], 'local/controller port interface') + require(len(word['center_frames']) == len(canonical['center_frames']) == 8, 'eight centre interfaces') + require([basis(word['frames'][f]) for f in word['center_frames']] == [basis(canonical['frames'][f]) for f in canonical['center_frames']], 'ordered centre-frame interface') + context = make_context(parent, phases, canonical['ports'], word, replay, roles) + receipt = check_roles(context, roles) + receipt['controls_rejected'] = controls(context, roles) + receipt['input_sha256'] = {str(path): filehash(path) for path in (args.baseline_parent, phases_path, canonical_path, args.word, replay_path, args.owners)} + args.out.write_text(json.dumps(receipt, indent=2) + '\n', encoding='utf-8') + print(receipt['status'], 'roles=' + str(receipt['roles']), 'controls=' + str(len(receipt['controls_rejected']))) + + +if __name__ == '__main__': + main() diff --git a/research/complex-t37-owners/owner_controls.py b/research/complex-t37-owners/owner_controls.py new file mode 100644 index 0000000000..7ad93cc5cc --- /dev/null +++ b/research/complex-t37-owners/owner_controls.py @@ -0,0 +1,63 @@ +# SPDX-License-Identifier: Apache-2.0 +"""Reject every omitted T37 edit and a non-interleaved (sequential) schedule.""" +import argparse +import copy +from pathlib import Path +from common import HERE, ROOT, read, require, dump, load +from build_owners import move + + +def main(): + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument('--base', type=Path, required=True) + parser.add_argument('--local', type=Path, required=True) + parser.add_argument('--owners', type=Path, required=True) + parser.add_argument('--order', type=Path, required=True) + parser.add_argument('--out', type=Path, required=True) + args = parser.parse_args() + audit = load(HERE/'independent_check.py', 'independent_t37_controls') + audit.T, audit.EXPECTED_IDLE = 37, {48: 11086, 1: 6} + parent = read(args.base/'split-centres/GLOBAL-TEMPLATE.json.gz') + phases = read(args.base/'work/complex-nine-native/DATA-PHASES.json') + ports = read(args.base/'split-centres/CANONICAL-WORD.json.gz')['ports'] + word = read(args.local/'CANONICAL-WORD.json.gz') + replay = read(args.local/'INDEPENDENT-LOCAL-REPLAY.json') + roles = read(args.owners) + context = audit.make_context(parent, phases, ports, word, replay, roles) + audit.check_roles(context, roles) + plan = read(ROOT/'research/gauge44-frames-x/data/PLAN.json') + rejected = [] + for edit in read(HERE/'data/EDITS.json'): + bad = copy.deepcopy(roles) + role = next(r for r in bad if [r['time'], r['helper']] == edit['role']) + move(role, edit['before'], plan) + try: + audit.check_roles(context, bad) + except ValueError as error: + rejected.append(dict(role=edit['role'], reason=str(error))) + else: + raise ValueError('Accepted omitted T37 edit: '+str(edit['role'])) + require(len(rejected) == 8, 'Eight omitted-edit rejections') + # The same roles under the complete sequential schedule (all T21 calls, + # then all second-T16 calls). Each component keeps its own order, so only + # the cross-component trade can fail; rebuild the actual event windows. + order = read(args.order) + sequential = [key for key in order if key[1] < 21]+[key for key in order if key[1] >= 21] + at = {tuple(key): time for time, key in enumerate(sequential)} + bad = copy.deepcopy(roles) + for role in bad: + role['time'] = at[role['stage'], role['replica']] + other = audit.make_context(parent, phases, ports, word, replay, bad) + try: + audit.check_roles(other, bad) + except ValueError as error: + sequential_reason = str(error) + else: + raise ValueError('Accepted sequential schedule') + dump(args.out, dict(status='PASS_EIGHT_T37_OMITTED_EDITS_AND_SEQUENTIAL_CONTROL', + omitted_edit_controls=rejected, sequential_schedule_rejection=sequential_reason)) + print('PASS eight omitted edits and sequential-schedule control') + + +if __name__ == '__main__': + main() diff --git a/research/complex-t37-owners/price.py b/research/complex-t37-owners/price.py new file mode 100644 index 0000000000..5600254528 --- /dev/null +++ b/research/complex-t37-owners/price.py @@ -0,0 +1,66 @@ +# SPDX-License-Identifier: Apache-2.0 +"""Two unchanged exact moment engines and all 47 outer inequalities for T37. + +The retained outer helper checks its bootstrap cutoffs against the old 512-bit +charge; they are rechecked here against the charged 1024-bit payload. +""" +import argparse +import hashlib +from fractions import Fraction +from pathlib import Path +from common import HERE, ROOT, read, require, sha, dump, load + + +def bootstrap(c, b, payload=1024): + """The seven retained bootstrap levels with cutoffs charged at 2*(4+payload).""" + eta = beta = Fraction(1, 10**24) + s = min(c, (1-beta)*b)-Fraction(1, 10**27) + a, rows = Fraction(384599, 10**10), [] + for _ in range(7): + old, a = a, (1-s)*s+s*a + gap = min(s-a, 1-a-s, 1-a-s*(1-old), 1-s) + require(old < a < s < 1-a and gap > 0, 'bootstrap gap') + cut = max(-(-36//gap**2), -(-(2*(4+payload))//gap)) + require(cut*gap**2 >= 36 and cut*gap >= 2*(4+payload), 'payload-charged bootstrap cutoff') + rows.append(dict(gap=str(gap), cutoff_log2=str(cut))) + return rows + + +def main(): + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument('--profile', type=Path, required=True) + parser.add_argument('--out', type=Path, required=True) + args = parser.parse_args() + old = load(ROOT/'research/complex-t21-owners/vendor/pr870/independent/price_profile_t16.py', 'unchanged_price_helpers') + pins = read(ROOT/'research/complex-t21-owners/vendor/pr870/data/UPSTREAM-PINS.json') + for name in ('moment', 'base_two_moment', 'outer'): + relative = old.SOURCE/'engines'/(name+'.py') + require(sha(ROOT/relative) == pins[relative.as_posix()], 'Exact arithmetic source pin') + M, B, A = [old.load(ROOT/old.SOURCE/'engines', name) for name in ('moment', 'base_two_moment', 'outer')] + supplied, claim = read(args.profile), read(HERE/'data/CLAIM.json') + require((supplied['live'], supplied['deficit']) == (33152, 11840), 'T37 profile stock and deficit') + profile = {int(rank): count for rank, count in supplied['profile'].items()} + bit_bytes = old.BIT_PATH.read_bytes() + require(hashlib.sha1(b'blob '+str(len(bit_bytes)).encode()+b'\0'+bit_bytes).hexdigest() == old.BIT_BLOB, 'PR589 bit supplier blob') + bit = read(old.BIT_PATH) + deficit = old.pr589_deficit(bit['word'], bit['nine']['bit']['live']) + c = Fraction(bit['nine']['bit_lower']) + bit_checks = old.moment_checks(M, B, {int(r): n for r, n in bit['nine']['profile'].items()}, + 64, bit['nine']['bit']['live'], c, deficit, True) + prices = {} + for mode, surcharge in (('native', False), ('conservative', True)): + root = M.certify(profile, 73, 33152, surcharge) + b = Fraction(root['lower']) + prices[mode] = dict(root=root, moments=old.moment_checks(M, B, profile, 73, 33152, b, 11840, surcharge), + outer=old.outer47(c, b, A), bootstrap_payload1024=bootstrap(c, b)) + require(prices['native']['outer']['kappa'] == str(Fraction(claim['kappa'])), 'Claimed T21 exponent') + require(Fraction(prices['native']['root']['lower']) == Fraction(claim['complex_lower']), 'Claimed complex endpoint') + result = dict(status='PASS_T37_TWO_EXACT_ENGINES_AND_OUTER47', prices=prices, bit_checks=bit_checks, + profile_sha256=sha(args.profile), gain_over_pr890=str(Fraction(claim['kappa'])-Fraction(claim['baseline890_kappa'])), + scope='Exact arithmetic for the independently recounted T37 profile; full controller and invoice admission are separate mandatory stages.') + dump(args.out, result) + print(result['status'], prices['native']['outer']['kappa_decimal']) + + +if __name__ == '__main__': + main() diff --git a/research/complex-t37-owners/source_adapters.py b/research/complex-t37-owners/source_adapters.py new file mode 100644 index 0000000000..7c906c7a52 --- /dev/null +++ b/research/complex-t37-owners/source_adapters.py @@ -0,0 +1,48 @@ +# SPDX-License-Identifier: Apache-2.0 +"""Parameterize the replication-dependent PR870 checker cardinalities for T37. + +The vendored PR870 sources are read from PR890's package and pinned there. +Beyond cardinalities, the charged global prefix payload changes from 512 to +1024 bits; every place that charges it (prefix reserve, row reserve 2*payload, +bootstrap cutoff 2*(4+payload)) is edited explicitly, and the retained +PR531 invoice is still required to have been charged at 512. + +The literal edit table records each before/after string and expected count. +Constants unrelated to replicas, including 144 factors per wrapper and the +scalar adapter multiplier 16, are unchanged. Source notices are preserved. +""" +import argparse +import shutil +from common import HERE, ROOT, read, require, sha, dump + +T21 = ROOT/'research/complex-t21-owners' + + +def materialize(out): + source = T21/'vendor/pr870' + pins = read(T21/'VENDOR-PINS.json')['pr870']['files'] + edits = read(HERE/'data/ADAPTER-EDITS.json') + require(not out.exists(), 'Runtime output must be new') + (out/'code').mkdir(parents=True) + receipt = {} + for path in sorted((source/'code').glob('*.py')): + relative = 'code/'+path.name + require(sha(path) == pins[relative], 'Vendored source pin: '+relative) + text = path.read_text() + for before, after, count in edits.get(path.name, []): + require(text.count(before) == count, 'Exact edit multiplicity: '+path.name+' '+before) + text = text.replace(before, after) + target = out/'code'/path.name + target.write_text(text) + receipt[path.name] = dict(source_sha256=pins[relative], output_sha256=sha(target), + edits=edits.get(path.name, [])) + shutil.copytree(source/'inputs', out/'inputs') + dump(out/'ADAPTERS.json', receipt) + return receipt + + +if __name__ == '__main__': + from pathlib import Path + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument('out', type=Path) + materialize(parser.parse_args().out) diff --git a/research/complex-t37-owners/verify.py b/research/complex-t37-owners/verify.py new file mode 100644 index 0000000000..238a29e623 --- /dev/null +++ b/research/complex-t37-owners/verify.py @@ -0,0 +1,244 @@ +# SPDX-License-Identifier: Apache-2.0 +"""Cold U8/T37/PR589 replay, with explicit hash-checked ancestry reuse. + +Default rebuilds PR799, PR741 and PR589 before rebuilding the U8 local word. +The only reuse option accepts a complete PR799 replay and its complete ancestry; +the unchanged upstream binding checker and fixed stage-coverage check rerun. +No discovery mode or optimizer is exposed. Outputs must be outside this checkout. +""" +import argparse +import copy +from fractions import Fraction +import os +from pathlib import Path +import shutil +import subprocess +import sys +import time +from common import HERE, ROOT, read, require, sha, identity, dump, load + +SOURCE = ROOT/'research/complex-k492-owner-repair/vendor/multicold' +T21 = ROOT/'research/complex-t21-owners' +VENDOR = T21/'vendor' + + +def validate_pins(): + path = HERE/'MANIFEST.json' + manifest = read(path) + actual = {p.relative_to(HERE).as_posix(): sha(p) for p in HERE.rglob('*') + if p.is_file() and p != path and '__pycache__' not in p.parts} + require(actual == manifest, 'Package manifest mismatch') + for relative, expected in read(HERE/'DEPENDENCY-PINS.json').items(): + p = (ROOT/relative).resolve() + require(not Path(relative).is_absolute() and p.is_relative_to(ROOT), 'Dependency path') + require(sha(p) == expected, 'Repository dependency changed: '+relative) + for label, record in read(T21/'VENDOR-PINS.json').items(): + for relative, expected in record['files'].items(): + require(sha(VENDOR/label/relative) == expected, 'Vendored source changed: '+relative) + return dict(manifest_sha256=sha(path), dependencies_sha256=sha(HERE/'DEPENDENCY-PINS.json')) + + +def semantic_identities(plan_path, owner_path): + plan, roles = read(plan_path), read(owner_path) + require(plan['assignment_sha256'] == plan['replica_lift']['owners_file_sha256'] == sha(owner_path), + 'Stale owner container reference') + content = identity(roles) + require(plan['assignment_content_sha256'] == content, 'Stale owner content reference') + value = copy.deepcopy(plan) + value['assignment_sha256'] = value['replica_lift']['owners_file_sha256'] = content + return dict(owners_content_sha256=content, plan_semantic_sha256=identity(value)) + + +def runtime_spec(plan_path, owner_path): + frozen = read(HERE/'data/SPEC.json') + ids = semantic_identities(plan_path, owner_path) + require(all(frozen['data'][key] == value for key, value in ids.items()), 'Frozen owner/plan semantic identity') + value = copy.deepcopy(frozen) + value['data']['owners_sha256'], value['data']['plan_sha256'] = sha(owner_path), sha(plan_path) + pivot = (T21/frozen['pivot_swap']['recipe']).resolve() + require(pivot.is_relative_to(T21) and sha(pivot) == frozen['pivot_swap']['sha256'], 'Immutable pivot recipe') + value['pivot_swap']['recipe'] = str(pivot) + return value, ids + + +def final_binding(work, stages, pins, reuse, baseline, ancestor): + claim = read(HERE/'data/CLAIM.json') + assembly = read(work/'ASSEMBLY.json') + independent = read(work/'INDEPENDENT-T37.json') + g = work/'global' + owners = read(g/'audit/OWNERS-AND-PROFILE.json') + controller = read(g/'audit/ASYNC-AUDIT.json') + invoice = read(g/'audit/PREFIX-AND-INVOICE.json') + price = read(work/'INDEPENDENT-PRICE.json') + spec, identities = runtime_spec(work/'lift/PLAN.json', work/'owners/OWNERS.json.gz') + require(spec == read(work/'runtime/data/SPEC.json'), 'Only authorized runtime SPEC fields may change') + require(assembly['status'] == 'PASS_GAUGE44_NATIVE_EXACT_GLOBAL_ASSEMBLY', 'Assembly status') + require(assembly['kappa'] == str(Fraction(claim['kappa'])) == price['prices']['native']['outer']['kappa'], 'Two exact prices agree') + require(Fraction(assembly['complex_lower']) == Fraction(claim['complex_lower']) and + Fraction(assembly['bit_lower']) == Fraction(claim['bit_lower']), 'Both certified endpoints') + require(Fraction(assembly['kappa']) > Fraction(claim['baseline890_kappa']), 'Strict gain over PR890') + require(assembly['complex_profile'] == independent['profile'] == owners['paid_profile'] == + controller['complex_profile'] == read(work/'lift/PLAN.json')['profile'] == spec['expected']['global_profile'], + 'All independent profile recounts agree') + for key in ('roles', 'calls', 'live', 'physical', 'rank_mass', 'deficit', 'prefix_bits'): + require(independent[key] == claim[key], 'Independent T37 '+key) + for key in ('live', 'physical', 'rank_mass', 'deficit'): + require(owners[key] == independent[key], 'Owner/independent '+key) + require(independent['roles'] == owners['hosted_residuals'] == controller['complex_hosted_residuals'] == 167832, 'Whole-helper inventory') + require(independent['calls'] == controller['complete_invocations'] == invoice['complete_invocation_sweeps'] == 333, 'Complete invocation inventory') + require(independent['physical_row_coefficient'] == invoice['finite']['physical_row_coefficient'] == claim['row_coefficient'] < 20161, 'Physical row reserve') + require(independent['prefix_bits'] == invoice['global_prefix_bits'] == 779 < invoice['charged_prefix_bits'] == 1024 == + independent['charged_prefix_bits'] and invoice['row_prefix_extra'] == 2048, 'Charged prefix reserve') + require(independent['actual_73_axis_charts'] == owners['actual_73column_sigmas'] == controller['actual_orthogonal_73column_maps'], 'Independent chart recount') + require(independent['idle'] == claim['idle'] and len(independent['controls_rejected']) == 6, 'T37 independent controls') + inherited = read(work/'INDEPENDENT-T21.json') + require(len(inherited['controls_rejected']) == 6 and inherited['roles'] == 95256 and inherited['calls'] == 189 and + inherited['idle'] == {'48': 6292, '3': 1, '1': 3}, 'Inherited PR890 T21 witness and controls') + pc = read(work/'PARENT-CHECK.json') + require(pc['status'] == 'PASS_INDEPENDENT_T37_PARTIAL_BANK_ENVELOPE' and len(pc['controls_rejected']) == 8, 'Partial-bank audit and controls') + require(pc['parent_content_sha256'] == identity(read(work/'lift/GLOBAL-TEMPLATE.json.gz')) == + invoice['parent_template_sha256'], 'Exact checked partial-bank parent identity') + require(pc['source_content_sha256'] == identity(read(baseline/'global/global/base/split-centres/GLOBAL-TEMPLATE.json.gz')), 'Exact original parent identity') + oc = read(work/'OWNER-CONTROLS.json') + require(len(oc['omitted_edit_controls']) == 8 and oc['sequential_schedule_rejection'], 'Eight edits and sequential-schedule control') + construction = read(work/'owners/OWNER-CONSTRUCTION.json') + require(construction['changed_roles'] == 8 and construction['t21_construction']['changed_roles'] == 9, 'Owner construction coverage') + require(construction['owners_sha256'] == sha(work/'owners/OWNERS.json.gz') and + construction['owners_content_sha256'] == identities['owners_content_sha256'], 'Constructed owner binding') + ac, bc = read(work/'ADMISSION-CONTROLS.json'), read(work/'BIT-CONTROLS.json') + require(len(ac['rejected_controls']) == 69 and not ac['discovery_accepted_controls'], 'Strict admission controls') + require(len(bc['rejected_controls']) == 12 and bc['derived_deficit'] == 10272, 'PR589 controls') + require(controller['mutation_controls_run'] and len(controller['mutations_rejected']) == 15, 'Controller mutation controls') + require(invoice['strict_checks'] and all(invoice['strict_checks'].values()), 'Complete finite invoice') + require(len(assembly['outer']) == 47 and all(Fraction(v) > 0 for v in assembly['outer'].values()), 'All 47 strict outer inequalities') + require(assembly['template_sha256'] == owners['template_sha256'] == invoice['template_sha256'] == controller['complex_template_sha256'], 'One emitted controller identity') + require(invoice['owner_audit_sha256'] == sha(g/'audit/OWNERS-AND-PROFILE.json') and invoice['controller_audit_sha256'] == sha(g/'audit/ASYNC-AUDIT.json'), 'Invoice receipt binding') + native_steps = read(work/'native/STEPS.json') + require([s['step'] for s in native_steps] == ['barch', 'barch-controls', 'layer-end-controls', 'native', 'ledgers', 'local-replay', 'wrappers', 'phases'] and + all(s['exit_code'] == 0 for s in native_steps), 'Complete fresh U8 local stages') + require(len(read(work/'native/barch-controls/controls.json')) == 38, 'U8 construction control inventory') + require(len(read(work/'native/controls/COLD-END-CONTROLS.json')['rejected']) == 95, 'Inherited end-control inventory') + native = work/'native/local' + for name in ('CANONICAL-WORD.json.gz', 'LOCAL-PROGRAMS.json.gz', 'LOCAL-CHECKS.json', + 'INDEPENDENT-LOCAL-REPLAY.json', 'CLIFFORD-RECIPES.json', 'CLIFFORD-REVIEW.json', 'RESIDUAL-ADAPTERS.json'): + require(read(g/'base/providers/gauge44'/name) == read(native/name), 'Fresh local-provider binding: '+name) + names = ['baseline741-coverage', 'baseline799-binding', 'native-u8', 'independent-local', 'build-owners', + 'build-parent', 'check-parent', 'independent-t21', 'independent-t37', 'owner-controls', 'source-adapters', + 'bind', 'emit', 'audit', 'invoice', 'assembly', 'admission-controls', 'bit-controls', 'independent-price'] + require([s['name'] for s in stages] == ([] if reuse else ['baseline799-cold'])+names and + all(s['exit_code'] == 0 for s in stages), 'Fixed complete stage sequence') + for stage in stages: + require(sha(work/stage['log']) == stage['log_sha256'], 'Stage log binding') + coverage = load(VENDOR/'pr858/baseline_coverage.py', 'fixed_ancestral_coverage') + require(read(work/'BASELINE741-COVERAGE.json') == coverage.check(ancestor), 'Complete fixed ancestral coverage binding') + sys.path.insert(0, str(ROOT/'scripts')) + try: + binding = load(ROOT/'scripts/verify_frontier799_bindings.py', 'unchanged_frontier799_binding') + expected = binding.check(ancestor, baseline/'native', baseline/'global', + baseline/'INDEPENDENT-LOCAL.json', baseline/'INDEPENDENT-PRICE.json') + finally: + sys.path.pop(0) + require(read(work/'BASELINE-BINDING.json') == expected, 'Complete fresh ancestral binding') + require(expected['kappa'] == str(Fraction('0.001661634653669567')), 'PR799 ancestor exponent') + artifacts = ['ASSEMBLY.json', 'INDEPENDENT-T21.json', 'INDEPENDENT-T37.json', 'INDEPENDENT-PRICE.json', + 'INDEPENDENT-LOCAL.json', 'PARENT-CHECK.json', 'OWNER-CONTROLS.json', 'ADMISSION-CONTROLS.json', + 'BIT-CONTROLS.json', 'BASELINE-BINDING.json', 'BASELINE741-COVERAGE.json', 'RUNTIME-BINDING.json', + 'owners/OWNER-CONSTRUCTION.json', 'owners/OWNERS.json.gz', 'owners/ORDER.json', + 'lift/PLAN.json', 'lift/GLOBAL-TEMPLATE.json.gz', 'lift/PARENT-LIFT.json', 'runtime/ADAPTERS.json', + 'runtime/data/SPEC.json', 'global/PLAN.json', 'global/BINDING.json', 'global/hosted/GLOBAL-TEMPLATE.json.gz', + 'global/audit/ASYNC-AUDIT.json', 'global/audit/OWNERS-AND-PROFILE.json', 'global/audit/PREFIX-AND-INVOICE.json', + 'native/STEPS.json', 'native/barch-controls/controls.json', 'native/controls/COLD-END-CONTROLS.json'] + return dict(status='PASS_STRICT_U8_T37_PR589_COMPOSITION', kappa=assembly['kappa'], kappa_decimal=assembly['kappa_decimal'], + delta_over_pr890=str(Fraction(assembly['kappa'])-Fraction(claim['baseline890_kappa'])), + complex_lower=assembly['complex_lower'], bit_lower=assembly['bit_lower'], + profile=assembly['complex_profile'], roles=167832, calls=333, prefix_bits=779, + charged_prefix_bits=1024, row_coefficient=claim['row_coefficient'], + baseline_mode='explicit_checked_reuse' if reuse else 'cold_rebuilt', package_pins=pins, + semantic_identities=identities, stages=len(stages), artifact_sha256={p: sha(work/p) for p in artifacts}, scope=claim['scope']) + + +def main(): + require(not sys.flags.optimize, 'Assertions must remain enabled') + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument('--work', type=Path, required=True) + parser.add_argument('--baseline799', type=Path) + parser.add_argument('--ancestor741', type=Path) + args = parser.parse_args() + require((args.baseline799 is None) == (args.ancestor741 is None), 'Reuse requires both complete ancestry directories') + work = args.work.resolve() + require(not work.exists() and not work.is_relative_to(ROOT), 'New output directory outside the checkout required') + pins = validate_pins() + work.mkdir(parents=True) + env = dict(os.environ, PYTHONDONTWRITEBYTECODE='1', PYTHONUTF8='1', PYTHONINTMAXSTRDIGITS='0', + PYTHON=sys.executable, SW4_FRAME8_PYTHON=sys.executable, MULTICOLD_SOURCE=str(SOURCE), GAIN_PR564_SOURCE=str(SOURCE)) + for key in ('PYTHONOPTIMIZE', 'WITNESS_DISCOVER', 'WITNESS_RECORD', 'WITNESS_SPEC'): + env.pop(key, None) + stages = [] + + def run(name, script, *arguments): + log = work/(name+'.log') + start = time.monotonic() + with log.open('w', encoding='utf-8', newline='\n') as stream: + process = subprocess.run([sys.executable, '-B', str(SOURCE/'code/run_portable.py'), str(script), *map(str, arguments)], + cwd=ROOT, env=env, stdout=stream, stderr=subprocess.STDOUT) + stages.append(dict(name=name, exit_code=process.returncode, seconds=round(time.monotonic()-start, 3), + log=log.name, log_sha256=sha(log))) + dump(work/'STAGES.json', stages) + require(process.returncode == 0, name+' failed:\n'+log.read_text(errors='replace')[-5000:]) + print('PASS', name, stages[-1]['seconds'], flush=True) + + reuse = args.baseline799 is not None + baseline = args.baseline799.resolve() if reuse else work/'baseline799' + ancestor = args.ancestor741.resolve() if reuse else baseline/'ancestor' + if not reuse: + run('baseline799-cold', ROOT/'scripts/verify_frontier799.py', '--work', baseline) + run('baseline741-coverage', VENDOR/'pr858/baseline_coverage.py', '--ancestor', ancestor, '--out', work/'BASELINE741-COVERAGE.json') + run('baseline799-binding', ROOT/'scripts/verify_frontier799_bindings.py', '--ancestor', ancestor, + '--native', baseline/'native', '--global', baseline/'global', '--independent', baseline/'INDEPENDENT-LOCAL.json', + '--price', baseline/'INDEPENDENT-PRICE.json', '--out', work/'BASELINE-BINDING.json') + run('native-u8', VENDOR/'pr870/construction/barch/reproduce_barch.py', '--main', ROOT, + '--pr635', ROOT/'research/complex-sw4-frame8/vendor/pr635', '--jx-dir', baseline/'native', '--recipe', 'U8', '--out', work/'native') + local = work/'native/local' + run('independent-local', VENDOR/'pr870/independent/audit_local.py', '--word', work/'native/barch/FULL-WORD.json.gz', + '--main', ROOT, '--output', work/'INDEPENDENT-LOCAL.json') + run('build-owners', HERE/'build_owners.py', '--out', work/'owners') + base = baseline/'global/global/base' + run('build-parent', HERE/'build_parent.py', '--base', base, '--owners', work/'owners/OWNERS.json.gz', + '--order', work/'owners/ORDER.json', '--out', work/'lift') + run('check-parent', HERE/'check_parent.py', '--source', base/'split-centres/GLOBAL-TEMPLATE.json.gz', + '--parent', work/'lift/GLOBAL-TEMPLATE.json.gz', '--out', work/'PARENT-CHECK.json') + for label, checker, replicas, owners, idle in [ + ('t21', T21/'independent_check.py', 21, work/'owners/T21-OWNERS.json.gz', '{"48":6292,"3":1,"1":3}'), + ('t37', HERE/'independent_check.py', 37, work/'owners/OWNERS.json.gz', '{"48":11086,"1":6}')]: + run('independent-'+label, checker, '--baseline-parent', base/'split-centres/GLOBAL-TEMPLATE.json.gz', + '--owners', owners, '--word', local/'CANONICAL-WORD.json.gz', '--replicas', replicas, '--expected-idle', idle, + '--out', work/('INDEPENDENT-'+label.upper()+'.json')) + run('owner-controls', HERE/'owner_controls.py', '--base', base, '--local', local, '--owners', work/'owners/OWNERS.json.gz', + '--order', work/'owners/ORDER.json', '--out', work/'OWNER-CONTROLS.json') + run('source-adapters', HERE/'source_adapters.py', work/'runtime') + spec, identities = runtime_spec(work/'lift/PLAN.json', work/'owners/OWNERS.json.gz') + (work/'runtime/data').mkdir() + dump(work/'runtime/data/SPEC.json', spec) + dump(work/'RUNTIME-BINDING.json', identities) + env['WITNESS_SPEC'] = str(work/'runtime/data/SPEC.json') + shutil.copytree(baseline/'global/parent558', work/'parent') + shutil.copyfile(work/'lift/GLOBAL-TEMPLATE.json.gz', work/'parent/complex-global/base/split-centres/GLOBAL-TEMPLATE.json.gz') + code, g = work/'runtime/code', work/'global' + run('bind', code/'bind_providers_portable.py', '--baseline', work/'parent', '--provider', 'gauge44='+str(local), '--plan', work/'lift/PLAN.json', '--out', g) + run('emit', code/'emit_allcold.py', '--base', g/'base', '--owners', work/'owners/OWNERS.json.gz', '--plan', g/'PLAN.json', '--out', g/'hosted') + run('audit', code/'audit_allcold.py', g/'base', g/'hosted', g/'audit/ASYNC-AUDIT.json', '--mutation-controls') + run('invoice', code/'invoice_allcold.py', '--base', g/'base', '--hosted', g/'hosted', '--audit', g/'audit', '--out', g/'audit', + '--retained-invoice', SOURCE/'vendor/pr558/vendor/pr552/complex-global/vendor531/evidence/audit/PREFIX-AND-INVOICE.json') + run('assembly', code/'assemble.py', SOURCE, g, work/'ASSEMBLY.json') + for name, script, filename in [('admission-controls', 'assembly_controls.py', 'ADMISSION-CONTROLS.json'), + ('bit-controls', 'bit_supplier_controls.py', 'BIT-CONTROLS.json')]: + run(name, code/script, '--source-package', SOURCE, '--owner', g/'audit/OWNERS-AND-PROFILE.json', '--invoice', g/'audit/PREFIX-AND-INVOICE.json', '--out', work/filename) + run('independent-price', HERE/'price.py', '--profile', work/'INDEPENDENT-T37.json', '--out', work/'INDEPENDENT-PRICE.json') + require(validate_pins() == pins, 'Package changed during verification') + result = final_binding(work, stages, pins, reuse, baseline, ancestor) + dump(work/'RESULT.json', result) + print(result['status'], result['kappa_decimal'], flush=True) + + +if __name__ == '__main__': + main()