From 9a891c9cb25b15f5a189bcad1d022198adeaf885 Mon Sep 17 00:00:00 2001 From: Cinna Davis <1337isnot1337@users.noreply.github.com> Date: Wed, 14 Oct 2026 08:29:30 -0500 Subject: [PATCH] Add P111 bit Parseval plane decoder screen --- .../README.md | 93 +++++ .../RESULT.json | 1 + .../SOURCES.json | 78 ++++ .../TASK.json | 69 ++++ .../VERIFY.json | 23 ++ .../verify.py | 346 ++++++++++++++++++ 6 files changed, 610 insertions(+) create mode 100644 research/bit-p111-parseval-plane-decoder-seedceccc765/README.md create mode 100644 research/bit-p111-parseval-plane-decoder-seedceccc765/RESULT.json create mode 100644 research/bit-p111-parseval-plane-decoder-seedceccc765/SOURCES.json create mode 100644 research/bit-p111-parseval-plane-decoder-seedceccc765/TASK.json create mode 100644 research/bit-p111-parseval-plane-decoder-seedceccc765/VERIFY.json create mode 100644 research/bit-p111-parseval-plane-decoder-seedceccc765/verify.py diff --git a/research/bit-p111-parseval-plane-decoder-seedceccc765/README.md b/research/bit-p111-parseval-plane-decoder-seedceccc765/README.md new file mode 100644 index 0000000000..c6d2da4dfb --- /dev/null +++ b/research/bit-p111-parseval-plane-decoder-seedceccc765/README.md @@ -0,0 +1,93 @@ +# Five plane queries for the selected P111 bit decoder + +**A finite bit-decoder construction and favorable coverage-law screen. No new supplier or `kappa` is claimed.** + +This package factors the exact 111-port decoder from the selected merged PR589 bit word into five rank-two queries. It uses one explicit 9-to-10 Parseval frame and keeps both source and target endpoint maps. The construction is at the decoder boundary; its plane-frame route, physical streaming schedule, hosting and precision invoice remain open. + +## Construction + +The frozen word has nine retained source channels. Write their target and source factors as matrices `P` and `Q`, so the scatter map is `P Q^T`. The ten columns below are vectors in `F2^9`: + +```text +a1 = e1 + e2 a2 = e1 + e3 +a3 = e2 + e3 a4 = e1 + e2 + e3 +a5 = e4 a6 = e5 +a7 = e6 a8 = e7 +a9 = e8 a10 = e9 +``` + +They satisfy the exact identity + +```text +sum(j=1..10) aj aj^T = I9 over F2. +``` + +Transform both factor lists by these ten columns, then group columns `(1,2)`, `(3,4)`, `(5,6)`, `(7,8)`, `(9,10)`. Each pair gives one rank-two plane query. Therefore + +```text +(P A)(Q A)^T = P (A A^T) Q^T = P Q^T. +``` + +The verifier reconstructs the nine original channels from the pinned word and checks the equality on all 661 formal input columns at once, including dirty targets and helpers. It also checks the expected `B0 = (1 + G) mod 2` map on all 111 by 111 source-target pairs. The five transformed source and target factor pairs each have exact F2 rank two. + +## Copy and ADD invoice + +The original decoder has nine rank-seven B14 pairing terms, for copy charge `63`. For each new plane, the rational pairing rank between the union of its target support and the union of its source support is exactly eight. The five plane queries therefore cost `40`, saving 23 copy-rank units (36.51%) at the algebraic decoder boundary. + +Forming the ten frame channels from the nine old channels takes five XOR additions on each side, ten ADDs total. The favorable local profile charges those ten as rank-one children, removes nine rank-seven copy children, and adds five rank-eight plane children: + +```text +before: {1:1323, 2:1342, 3:79, 4:44, 5:102, 6:11, 7:19}, mass 5129 +after: {1:1333, 2:1342, 3:79, 4:44, 5:102, 6:11, 7:10, 8:5}, mass 5116 +``` + +This charges the binary basis change and every B14 copy rank in the proposed decoder. It does not charge physical frame transitions, temporary storage and cleanup, hosting, precision/tape, or composition with the rest of the bit word. Those costs can only reduce the favorable ceiling below. + +## Replacement coverage identity and budget + +For the pinned bit profile, `m=64`, `v=111`, `K=4`, and nine stages give `W=2 K v / 9 = 888/9 = 296/3` live families per local call. The selected line-port law is + +```text +paid mass = (m - 1) W + 63 = 6279. +``` + +The proposed two-unpaid-coordinate plane law is + +```text +paid mass = (m - 2) W + 40 = 18472/3. +``` + +The exact local profile leaves idle masses `1150` and `3124/3`, respectively. Applying the pinned ceiling routine with its selected nine-stage guard `R=42` gives: + +| Model | Certified `a` bracket | Idle mass | +|---|---:|---:| +| Existing line decoder | `[973733779/500000000000, 1947467559/10^12]` | `1150` | +| Five-plane decoder, all other new interface costs set to zero | `[4260424781/500000000000, 8520849563/10^12]` | `3124/3` | + +At `a=1/99`, the favorable plane relaxation is already greater than one (`1.0047022529...`), so this construction does not reach that planning target. The result is a decoder-cost mechanism, not a replacement bit supplier. The selected result remains complex-bound; no overall `kappa` improvement follows from this screen. + +## Reproduction + +From the repository root: + +```sh +python3 -B research/bit-p111-parseval-plane-decoder-seedceccc765/verify.py > research/bit-p111-parseval-plane-decoder-seedceccc765/RESULT.json +python3 scripts/research_package.py --package research/bit-p111-parseval-plane-decoder-seedceccc765 --check-only +python3.12 scripts/research_package.py --package research/bit-p111-parseval-plane-decoder-seedceccc765 +``` + +The verifier uses exact F2 and rational arithmetic. [RESULT.json](RESULT.json) is its deterministic output. Four negative controls check a broken frame, an omitted plane, a switched source factor and a collapsed rank-two factor. Expected status is `PASS_BIT_P111_PARSEVAL_PLANE_DECODER`; the report includes the dirty-map SHA-256 and exact ceiling brackets. The registered replay uses Python 3.12; this local environment currently provides Python 3.14, so the command-level verifier and metadata check are the local evidence. + +## Provenance and scope + +- Cycle seed: `ceccc7658dd89c833863007fb63ad7b2`; track `recursive-interfaces`; task `coverage-law-change`; priority revision 3. +- Base: `0b1cccf86e2f5132ed286a26ef0a681a495740ea`; selected-record SHA-256: `10b9e340fd8e354a37a0c4813c90e5de1dd42044b5f6aca4a3fc5a42b685fa32`. +- Bit input: merged PR589's `research/e8-bit-p111-tuned/tune/bitE8mut-p111-tuned.json.gz`, content SHA-256 `5642fd0e35a1acc11acff8d0c08350c1617e95f310d4d35ad63a651f9eeeba0b`; archive SHA-256 `e3e301e62bc2b41dbf1ceac0acf3d35824ebeab1848c5a2142d4577b109da52f`. +- Discussion claim: [#1587 comment 18924772](https://github.com/CrocSwap/integer-mult-bounds/discussions/1587#discussioncomment-18924772). The fresh 2026-10-14 overlap refresh covered 540 open PRs and 524 Discussions with complete pagination and returned no exact term matches. PR #1825 remains the selected complex-side paired-plane construction and lists this bit-side physical realization as open. +- The work builds on PR589/PR555's bit word and PR1084's exact line-decoder pricing model. The plane endpoint question is from Discussion #1587; no code from PR #1825 is used. +- Prepared by Cinna Davis with substantial OpenAI Codex assistance in construction, exact arithmetic, verification and writing. No independent human review is claimed. New work is Apache-2.0. + +## Open next questions + +- **Can these five coefficient planes be placed in a legal nested-frame schedule with streamed cleanup and whole-call hosting?** The exact decoder equality makes this the physical blocker. First derive source and target frame paths for each pair from the pinned 111-port geometry and test a two-plane dirty-register schedule. The current selected word records line-port routes only. +- **Can a completed bit plane supplier compose with the complex paired-plane construction to improve the selected conditional bound?** The selected result is complex-bound, so this decoder alone cannot move `kappa`. First combine both all-cost invoices in one exact assembly after the route and precision obligations close. PR #1825 still leaves its all-cost complex route open. diff --git a/research/bit-p111-parseval-plane-decoder-seedceccc765/RESULT.json b/research/bit-p111-parseval-plane-decoder-seedceccc765/RESULT.json new file mode 100644 index 0000000000..65734d430c --- /dev/null +++ b/research/bit-p111-parseval-plane-decoder-seedceccc765/RESULT.json @@ -0,0 +1 @@ +{"base_commit":"0b1cccf86e2f5132ed286a26ef0a681a495740ea","baseline_a_ceiling":["973733779/500000000000","1947467559/1000000000000"],"baseline_idle_mass":"1150","baseline_mass":"6279","basis_adds_charged":10,"controls":4,"copy_charge_line":63,"copy_charge_planes":40,"formal_dirty_input_columns":661,"full_dirty_decoder_sha256":"ae93f3411b3c799e482738a89db1e8a7f48bac8768030a649b2ffd63034e6b62","kappa_claim":false,"line_copy_costs":[7,7,7,7,7,7,7,7,7],"parseval_columns_hex":["0x3","0x5","0x6","0x7","0x8","0x10","0x20","0x40","0x80","0x100"],"plane_a_ceiling":["4260424781/500000000000","8520849563/1000000000000"],"plane_at_1_over_99_relaxation_lower":"116336572933712950230721466055437294176940130147802427912377566750618070383397/115792089237316195423570985008687907853269984665640564039457584007913129639936","plane_copy_costs":[8,8,8,8,8],"plane_factor_ranks":[[2,2],[2,2],[2,2],[2,2],[2,2]],"plane_target_source_support_sizes":[[89,85],[85,84],[86,88],[86,84],[90,87]],"planes_zero_based":[[0,1],[2,3],[4,5],[6,7],[8,9]],"ports":111,"replacement_idle_mass":"3124/3","replacement_mass":"18472/3","seed":"ceccc7658dd89c833863007fb63ad7b2","selected_record_sha256":"10b9e340fd8e354a37a0c4813c90e5de1dd42044b5f6aca4a3fc5a42b685fa32","status":"PASS_BIT_P111_PARSEVAL_PLANE_DECODER","unpriced_interface_obligations":["physical plane-frame routes and transitions","streaming/register schedule and cleanup","owner hosting and whole-call placement","precision/tape and integration with the selected complex supplier"]} diff --git a/research/bit-p111-parseval-plane-decoder-seedceccc765/SOURCES.json b/research/bit-p111-parseval-plane-decoder-seedceccc765/SOURCES.json new file mode 100644 index 0000000000..35a04baaff --- /dev/null +++ b/research/bit-p111-parseval-plane-decoder-seedceccc765/SOURCES.json @@ -0,0 +1,78 @@ +{ + "schema_version": 1, + "base_commit": "0b1cccf86e2f5132ed286a26ef0a681a495740ea", + "files": [ + { + "path": "certificates/selected-result.json", + "usage": "provenance", + "git_blob": "ae6a99f28aa468649eb66a361e764d769363bf11", + "sha256": "10b9e340fd8e354a37a0c4813c90e5de1dd42044b5f6aca4a3fc5a42b685fa32" + }, + { + "path": "docs/research/agent-task-catalog.json", + "usage": "provenance", + "git_blob": "06c96f5579bb67ed1b86d334e78fbed7da6945f1", + "sha256": "6686ad58f1fbdbc87134a78901b60fd53a20d3984355e91defbbebc9e9fa8075" + }, + { + "path": "docs/research/community-batch1099-review.md", + "usage": "provenance", + "git_blob": "6cb6ec061a071a06a2d18cd4dc3e9a2b05d28099", + "sha256": "7e76d2c38e5fce30587835b7251df1430488ae4dd372611ef69a3f03f476b6cb" + }, + { + "path": "research/bit-orthogonal-pair-decoders/PROOF.md", + "usage": "provenance", + "git_blob": "be3243952be4a1a8f5901829c73ce425ab217d16", + "sha256": "d89b42d4aa2e6bf2c3ac454404fd1aeddbf2eb07f6ff1fc606057e3b2a928f78" + }, + { + "path": "research/bit-orthogonal-pair-decoders/verify.py", + "usage": "provenance", + "git_blob": "1024748736844198a3ea92d0f35f651504f9ed04", + "sha256": "512df34b78791155d15467d1036a4fe217b007f40126abdcdc8a31c24ca94b1b" + }, + { + "path": "research/community-frontier1094-audit/ASSEMBLY.json", + "usage": "input", + "git_blob": "5fd676df060f3b450782fdf5ff5f6beb63a5eeb0", + "sha256": "1122cb3a575f8c788345fc1bf4c108ac7c3250fb81a5988671f5eb04b3ab3045" + }, + { + "path": "research/community-frontier1094-audit/SELECTED-SOURCE.json", + "usage": "provenance", + "git_blob": "6a75493790b4eff9c4a98051ef8b01d6aad0d5a8", + "sha256": "79b3de5db3dbcb9829789ba58e9e45758926031e2a7d80667a08429d369be53b" + }, + { + "path": "research/complex-local-word-ceiling/ceiling.py", + "usage": "input", + "git_blob": "6c0f54527d879396f689523bfde19928a9b6157c", + "sha256": "86a1432870b3b21d8454106ec9162fddc0471472d9214c590a1420f2426cedfc" + }, + { + "path": "research/e8-bit-p111-tuned/code/xcheck_p.py", + "usage": "provenance", + "git_blob": "184f5dcf94a486cc7db91ca4db5865916bf26009", + "sha256": "af3decc877e27c00001cf56f50c6c09566e8e101297ab34c7860aed96a06d80e" + }, + { + "path": "research/e8-bit-p111-tuned/tune/EXPECTED.json", + "usage": "input", + "git_blob": "e293ddc557742637f9f679f083a1a282d87b1b13", + "sha256": "b9f0e5ca038abe837b0007c8fe006f366a6f02009244ac57705a8a200e2301f4" + }, + { + "path": "research/e8-bit-p111-tuned/tune/README.md", + "usage": "provenance", + "git_blob": "5b1554369682c8344d4f0767111d9b2b35eecbec", + "sha256": "46c7917fb252949f38b7bcd88cf568efc282e3ea065b61d11e457e41673d0b2d" + }, + { + "path": "research/e8-bit-p111-tuned/tune/bitE8mut-p111-tuned.json.gz", + "usage": "input", + "git_blob": "85a4499bf9e4911a705d50567a2c2ef6cf23739a", + "sha256": "e3e301e62bc2b41dbf1ceac0acf3d35824ebeab1848c5a2142d4577b109da52f" + } + ] +} diff --git a/research/bit-p111-parseval-plane-decoder-seedceccc765/TASK.json b/research/bit-p111-parseval-plane-decoder-seedceccc765/TASK.json new file mode 100644 index 0000000000..90f88bed1b --- /dev/null +++ b/research/bit-p111-parseval-plane-decoder-seedceccc765/TASK.json @@ -0,0 +1,69 @@ +{ + "schema_version": 1, + "task_id": "coverage-law-change", + "priority_revision": 3, + "base_commit": "0b1cccf86e2f5132ed286a26ef0a681a495740ea", + "original_card": { + "id": "coverage-law-change", + "question": "Can a template or call contract leave two or more unpaid coordinates per live family?", + "starting_points": [ + "research/complex-local-word-ceiling/README.md", + "research/idle-axis-hosting/PROOF.md", + "certificates/selected-result.json" + ], + "methods": [ + "State a replacement for the coverage identity (mass = 72W + 64N) and the contract change that realizes it, with its implementation cost.", + "Find an obstruction: show which data-endpoint obligation forces exactly one unpaid coordinate in the current template." + ], + "acceptance_gate": "An explicit replacement identity, verified on a small complete instance with dirty inputs, priced with ceiling.ceiling(unpaid=...).", + "first_step": { + "command": [ + "python3", + "-B", + "research/complex-local-word-ceiling/verify.py" + ], + "expected": "PASS_COMPLEX_LOCAL_WORD_CEILING", + "inspect": "Read the selected word's per-call local profile, its packing ceiling and the lever table; run levers.py for the ideal budget of the lever you target.", + "scope": "Positive control and planning budget only; this is not a new construction or full cold replay." + }, + "first_experiment": "Explain where the single unpaid coordinate per family comes from in the hosted template; propose one change and price it. Ideal budget: two unpaid coordinates per family is 3.77x (levers.py).", + "bottleneck_link": "The deficit is one coordinate per family minus the centre charge; doubling unpaid coordinates per family scales it directly.", + "allowed_variations": [ + "One template change or one endpoint-contract change.", + "If the coverage law, template or guard changes, derive an applicable fully charged replacement bound instead of applying the incumbent ceiling outside its scope." + ], + "scope_change_triggers": [ + "Counting a coordinate as unpaid while leaving it unadvanced in the data endpoint." + ], + "overlap_terms": [ + "coverage identity", + "unpaid coordinate", + "deficit law", + "W - 64N" + ] + }, + "scope_status": "refined", + "actual_scope": "Replace the pinned P111 bit decoder's nine rank-one factors by five rank-two plane factors using a fixed 9-to-10 Parseval frame; verify the complete dirty decoder boundary and price the candidate two-unpaid coverage law.", + "scope_change_reason": "The broad coverage-law card is refined to the bit-side plane-port obligation explicitly left open in Discussion #1587 and PR #1825. This isolates one exact P111 decoder, one frame and one grouping instead of claiming a general template or supplier change.", + "bottleneck_link": "The selected bit supplier has a nine-term copy charge of 63 and remains above the selected complex-bound kappa. A cheaper exact plane decoder could preserve bit-side headroom if the open complex plane-port work raises the other side.", + "budget_minutes": 60, + "stop_rule": "Use only the displayed ten-column Parseval frame and five fixed column pairs. Stop after exact factorization, rational copy ranks, all dirty decoder input columns, the four negative controls and the favorable replacement-law ceiling. Do not search alternative frames or infer a physical supplier or kappa.", + "outcome": "partial", + "evidence": "verify.py reports PASS_BIT_P111_PARSEVAL_PLANE_DECODER: exact 111-by-661 dirty decoder map, five rank-two plane factors, copy charge 63 to 40, ten basis ADDs charged, replacement mass 18472/3 with idle 3124/3, and favorable a ceiling 8520849563/10^12. Physical plane routes, streaming cleanup, hosting and precision remain open.", + "author": "Cinna Davis", + "ai_assistance": "Substantial OpenAI Codex assistance in construction, exact arithmetic, implementation, verification and writing. No independent human review is claimed.", + "open_questions": [ + { + "question": "Can the five coefficient planes be realized by legal nested source and target frames in the P111 word, with streaming cleanup and owner hosting?", + "why_it_matters": "The exact matrix factorization and favorable ceiling do not establish that the five plane queries can replace the physical copy schedule.", + "first_step": "For each of the five explicit factor pairs, derive the required source/target frame from its 111-port supports and test a two-plane dirty-register schedule against the pinned route geometry.", + "blocked_by": "The selected P111 word records line-port geometry, not plane-port routes or a streamed 9-to-10 helper schedule." + }, + { + "question": "Does this bit-side mechanism combine with the selected complex paired-plane decoder to raise the accepted kappa?", + "why_it_matters": "The selected result is complex-bound, so this bit-side headroom alone cannot improve its conditional bound.", + "first_step": "After both physical suppliers have complete route, hosting, restoration and precision invoices, substitute their changed laws into one exact joint assembly.", + "blocked_by": "PR #1825 leaves its all-cost complex route and the bit-side physical realization open." + } + ] +} diff --git a/research/bit-p111-parseval-plane-decoder-seedceccc765/VERIFY.json b/research/bit-p111-parseval-plane-decoder-seedceccc765/VERIFY.json new file mode 100644 index 0000000000..996a6ae452 --- /dev/null +++ b/research/bit-p111-parseval-plane-decoder-seedceccc765/VERIFY.json @@ -0,0 +1,23 @@ +{ + "schema_version": 1, + "status": "ready", + "python": "3.12", + "requirements": [], + "inputs": [ + "research/community-frontier1094-audit/ASSEMBLY.json", + "research/e8-bit-p111-tuned/tune/EXPECTED.json", + "research/e8-bit-p111-tuned/tune/bitE8mut-p111-tuned.json.gz", + "research/complex-local-word-ceiling/ceiling.py" + ], + "commands": [ + { + "argv": [ + "{python}", + "-B", + "{package}/verify.py" + ], + "timeout_seconds": 120, + "checks": "Exact 111-by-661 dirty decoder identity, Parseval frame identity, five rank-two planes, rational B14 copy ranks, four negative controls, replacement coverage mass and exact favorable ceiling brackets" + } + ] +} diff --git a/research/bit-p111-parseval-plane-decoder-seedceccc765/verify.py b/research/bit-p111-parseval-plane-decoder-seedceccc765/verify.py new file mode 100644 index 0000000000..0728799018 --- /dev/null +++ b/research/bit-p111-parseval-plane-decoder-seedceccc765/verify.py @@ -0,0 +1,346 @@ +#!/usr/bin/env python3 +"""Exact P111 bit-decoder factorization through five rank-two planes.""" + +from fractions import Fraction +import gzip +import hashlib +import importlib.util +import json +from pathlib import Path +import subprocess + + +ROOT = Path(__file__).resolve().parents[2] +PACKAGE = Path(__file__).resolve().parent +WORD_PATH = ROOT / "research/e8-bit-p111-tuned/tune/bitE8mut-p111-tuned.json.gz" +EXPECTED_PATH = ROOT / "research/e8-bit-p111-tuned/tune/EXPECTED.json" +ASSEMBLY_PATH = ROOT / "research/community-frontier1094-audit/ASSEMBLY.json" +CEILING_PATH = ROOT / "research/complex-local-word-ceiling/ceiling.py" + +# Columns of a 9-by-10 Parseval frame over F2, in little-endian coordinates. +# The verifier checks sum_j a_j a_j^T = I_9 directly. +FRAME_COLUMNS = (0x003, 0x005, 0x006, 0x007, 0x008, + 0x010, 0x020, 0x040, 0x080, 0x100) +PLANES = ((0, 1), (2, 3), (4, 5), (6, 7), (8, 9)) +NINE = 9 +BASE_COMMIT = "0b1cccf86e2f5132ed286a26ef0a681a495740ea" + + +def require(condition, message): + if not condition: + raise ValueError(message) + + +def sha256(path): + return hashlib.sha256(path.read_bytes()).hexdigest() + + +def pinned_bytes(path): + return subprocess.run(["git", "show", f"{BASE_COMMIT}:{path}"], cwd=ROOT, + check=True, capture_output=True).stdout + + +def rank_f2(vectors): + pivots = {} + for value in vectors: + value = int(value) + while value: + bit = value.bit_length() - 1 + if bit not in pivots: + pivots[bit] = value + break + value ^= pivots[bit] + return len(pivots) + + +def frame_identity(columns): + return all( + sum(((column >> i) & 1) * ((column >> j) & 1) for column in columns) % 2 + == int(i == j) + for i in range(NINE) for j in range(NINE) + ) + + +def load_ceiling(): + spec = importlib.util.spec_from_file_location("pinned_ceiling", CEILING_PATH) + module = importlib.util.module_from_spec(spec) + spec.loader.exec_module(module) + return module + + +def rational_basis(rows, ncols=8): + matrix = [[Fraction(value) for value in row] for row in rows] + pivots = [] + rank = 0 + for col in range(ncols): + pivot = next((i for i in range(rank, len(matrix)) if matrix[i][col]), None) + if pivot is None: + continue + matrix[rank], matrix[pivot] = matrix[pivot], matrix[rank] + scale = matrix[rank][col] + matrix[rank] = [value / scale for value in matrix[rank]] + for i in range(len(matrix)): + if i != rank and matrix[i][col]: + scale = matrix[i][col] + matrix[i] = [x - scale * y for x, y in zip(matrix[i], matrix[rank])] + pivots.append(col) + rank += 1 + return matrix[:rank] + + +def rank_fraction(matrix, ncols): + return len(rational_basis(matrix, ncols)) + + +def pairing_rank(lines, target_mask, source_mask, v): + targets = [lines[i] for i in range(v) if (target_mask >> i) & 1] + sources = [lines[i] for i in range(v) if (source_mask >> i) & 1] + target_basis = rational_basis(targets) + source_basis = rational_basis(sources) + pairing = [ + [sum(x * y for x, y in zip(t, s)) / 2 for s in source_basis] + for t in target_basis + ] + return rank_fraction(pairing, len(source_basis)) + + +def decoder_map(left, right, n_targets): + """Return each target's linear form over every initial word register.""" + result = [] + for target in range(n_targets): + value = 0 + for lmask, rmask in zip(left, right): + if (lmask >> target) & 1: + value ^= rmask + result.append(value) + return result + + +def transformed_factors(old, columns): + result = [] + for column in columns: + value = 0 + for i in range(NINE): + if (column >> i) & 1: + value ^= old[i] + result.append(value) + return result + + +def plane_map(left, right, n_targets, planes=PLANES): + output = [0] * n_targets + for i, j in planes: + for target in range(n_targets): + if (left[i] >> target) & 1: + output[target] ^= right[i] + if (left[j] >> target) & 1: + output[target] ^= right[j] + return output + + +def serialize_masks(values, nbits): + size = (nbits + 7) // 8 + return b"".join(value.to_bytes(size, "little") for value in values) + + +def check(): + expected_bytes = EXPECTED_PATH.read_bytes() + word_bytes = WORD_PATH.read_bytes() + require(sha256(EXPECTED_PATH) == "b9f0e5ca038abe837b0007c8fe006f366a6f02009244ac57705a8a200e2301f4", + "pinned PR589 EXPECTED.json changed") + require(sha256(WORD_PATH) == "e3e301e62bc2b41dbf1ceac0acf3d35824ebeab1848c5a2142d4577b109da52f", + "pinned tuned PR589 word changed") + expected = json.loads(expected_bytes) + word = json.loads(gzip.decompress(word_bytes)) + selected = json.loads(pinned_bytes("certificates/selected-result.json")) + require(selected["source_manifest"] == "research/community-frontier1094-audit/SELECTED-SOURCE.json" + and selected["certificate"] == "research/community-frontier1094-audit/ASSEMBLY.json" + and selected["review"] == "docs/research/community-batch1099-review.md", + "selected-result pointers changed") + require(selected["certificate_sha256"] == sha256(ASSEMBLY_PATH) + == "1122cb3a575f8c788345fc1bf4c108ac7c3250fb81a5988671f5eb04b3ab3045", + "selected certificate hash mismatch") + require(hashlib.sha256(pinned_bytes("research/community-frontier1094-audit/SELECTED-SOURCE.json")).hexdigest() + == "79b3de5db3dbcb9829789ba58e9e45758926031e2a7d80667a08429d369be53b", + "selected source manifest changed") + require(hashlib.sha256(pinned_bytes("docs/research/community-batch1099-review.md")).hexdigest() + == "7e76d2c38e5fce30587835b7251df1430488ae4dd372611ef69a3f03f476b6cb", + "selected review changed") + word_record = expected["word"] + require(word["v"] == 111 and word_record["v"] == 111 and word["R"] == 439, + "not the selected punctured R439 P111 word") + require(word["punctured"] == [10, 15, 51, 53, 56, 66, 72, 89, 111], + "puncture list changed") + require(word_record["copy_ranks"] == [7] * NINE and word_record["decoder_constant"] == 63, + "line-port baseline decoder invoice changed") + require(hashlib.sha256(word_bytes).hexdigest() == word_record["file_sha256"], + "word archive does not match its receipt") + + assembly = json.loads(ASSEMBLY_PATH.read_text(encoding="utf-8")) + supplier = assembly["bit_supplier"] + require(supplier["pr"] == 589 and supplier["word"]["decoder_constant"] == 63, + "selected assembly no longer cites PR589's P111 word") + require(supplier["deficit_formula"] == "T(2Kv-L*cst), L=9 T=32 K=4 M=64", + "selected bit-side mass parameters changed") + + v = word["v"] + n_registers = 2 * v + word["R"] + values = [1 << register for register in range(n_registers)] + for section in ("D", "A"): + for _frame, destination, sources in word[section]: + for source in sources: + values[destination] ^= values[source] + + old_right = [values[register] for register in word["ret"]] + old_left = [sum(1 << target for target, row in enumerate(word["scatter"]) if k in row) + for k in range(NINE)] + require(len(old_left) == NINE and len(old_right) == NINE, "expected nine retained channels") + old_map = decoder_map(old_left, old_right, v) + + lines = [tuple(int(value) for value in row) for row in word["lines"]] + b0 = [ + sum((((1 + sum(x * y for x, y in zip(lines[t], lines[s])) // 2) & 1) << s) + for s in range(v)) + for t in range(v) + ] + for target in range(v): + require((old_map[target] & ((1 << v) - 1)) == b0[target], + f"source decoder row {target} does not equal B0=(1+G) mod 2") + old_costs = [pairing_rank(lines, old_left[i], + sum(1 << s for s in range(v) if (old_right[i] >> s) & 1), v) + for i in range(NINE)] + require(old_costs == [7] * NINE, f"line-port costs changed: {old_costs}") + + require(frame_identity(FRAME_COLUMNS), "Parseval frame identity failed") + new_left = transformed_factors(old_left, FRAME_COLUMNS) + new_right = transformed_factors(old_right, FRAME_COLUMNS) + new_map = plane_map(new_left, new_right, v) + require(new_map == old_map, "five-plane decoder differs on a dirty input basis column") + require(all((new_map[t] & ((1 << v) - 1)) == b0[t] for t in range(v)), + "five-plane decoder does not reproduce B0") + + plane_costs = [] + plane_ranks = [] + plane_sizes = [] + for i, j in PLANES: + require(rank_f2((new_left[i], new_left[j])) == 2, + f"target factors in plane {i // 2} are dependent") + require(rank_f2((new_right[i], new_right[j])) == 2, + f"source factors in plane {i // 2} are dependent") + target_union = new_left[i] | new_left[j] + source_union = 0 + for source in range(v): + if ((new_right[i] | new_right[j]) >> source) & 1: + source_union |= 1 << source + cost = pairing_rank(lines, target_union, source_union, v) + plane_costs.append(cost) + plane_ranks.append((rank_f2((new_left[i], new_left[j])), + rank_f2((new_right[i], new_right[j])))) + plane_sizes.append((target_union.bit_count(), source_union.bit_count())) + require(plane_costs == [8] * 5, f"unexpected plane copy ranks: {plane_costs}") + require(sum(plane_costs) == 40 and sum(old_costs) == 63, + "copy bill does not improve 63 -> 40") + + # The identity holds for every formal input column, including dirty helper + # coordinates: the nine source channels are multiplied by the same frame + # as the nine target channels, and A A^T = I exactly over F2. + full_input_digest = hashlib.sha256(serialize_masks(old_map, n_registers)).hexdigest() + require(hashlib.sha256(serialize_masks(new_map, n_registers)).hexdigest() == full_input_digest, + "dirty-input decoder digest differs") + + # Failure controls: a broken frame, omitted plane, switched source channel, + # and a collapsed rank-two source plane must all be rejected. + broken_columns = list(FRAME_COLUMNS) + broken_columns[3] ^= 1 << 8 + require(not frame_identity(broken_columns), "frame mutation was not detected") + require(plane_map(new_left, new_right, v, PLANES[:-1]) != old_map, + "omitted-plane control was not detected") + switched = list(new_right) + switched[0], switched[1] = switched[1], switched[0] + require(plane_map(new_left, switched, v) != old_map, + "switched-source control was not detected") + require(rank_f2((new_right[0], new_right[0])) != 2, + "collapsed-plane rank control is invalid") + + profile = {int(rank): int(count) for rank, count in word_record["local_histogram"].items()} + for rank in word_record["copy_ranks"]: + profile[rank] -= 1 + profile[8] = profile.get(8, 0) + len(PLANES) + # Five independent XORs on each side form the ten frame channels. + profile[1] += 2 * sum(column.bit_count() - 1 for column in FRAME_COLUMNS) + require(profile[1] == int(word_record["local_histogram"]["1"]) + 10, + "basis-change ADD invoice changed") + local_mass = sum(rank * count for rank, count in profile.items()) + require(local_mass == 5116, f"unexpected favorable local mass {local_mass}") + + ceiling = load_ceiling() + families = 2 * 4 * v + stages = 9 + m = 64 + max_child = expected["nine"]["bit"]["maxchild"] + require(families == 888 and max_child == 42, "selected bit coverage/guard inputs changed") + old_profile = {int(rank): int(count) for rank, count in word_record["local_histogram"].items()} + baseline_model = ceiling.model(old_profile, m, families, stages, 63, + R=max_child, unpaid=1) + changed_model = ceiling.model(profile, m, families, stages, 40, + R=max_child, unpaid=2) + require(baseline_model["total_mass"] == 6279 and baseline_model["idle_mass"] == 1150, + "baseline bit coverage identity mismatch") + require(changed_model["total_mass"] == Fraction(18472, 3) + and changed_model["idle_mass"] == Fraction(3124, 3), + "replacement bit coverage identity mismatch") + grid = Fraction(1, 10**12) + baseline_bracket = ceiling.ceiling(old_profile, m, families, stages, 63, + grid=grid, R=max_child, unpaid=1) + changed_bracket = ceiling.ceiling(profile, m, families, stages, 40, + grid=grid, R=max_child, unpaid=2) + target = Fraction(1, 99) + require(baseline_bracket[1] == Fraction(1947467559, 10**12), + "baseline ceiling replay differs") + require(changed_bracket[1] == Fraction(8520849563, 10**12), + "changed ceiling replay differs") + require(changed_bracket[1] < target and + ceiling.relax(profile, m, families, stages, 40, target, + R=max_child, unpaid=2)[0] > 1, + "favorable plane screen unexpectedly reaches a=1/99") + + return { + "status": "PASS_BIT_P111_PARSEVAL_PLANE_DECODER", + "seed": "ceccc7658dd89c833863007fb63ad7b2", + "base_commit": "0b1cccf86e2f5132ed286a26ef0a681a495740ea", + "selected_record_sha256": "10b9e340fd8e354a37a0c4813c90e5de1dd42044b5f6aca4a3fc5a42b685fa32", + "ports": v, + "formal_dirty_input_columns": n_registers, + "parseval_columns_hex": [hex(value) for value in FRAME_COLUMNS], + "planes_zero_based": [list(pair) for pair in PLANES], + "plane_factor_ranks": plane_ranks, + "plane_target_source_support_sizes": plane_sizes, + "line_copy_costs": old_costs, + "plane_copy_costs": plane_costs, + "copy_charge_line": sum(old_costs), + "copy_charge_planes": sum(plane_costs), + "basis_adds_charged": 10, + "full_dirty_decoder_sha256": full_input_digest, + "baseline_mass": str(baseline_model["total_mass"]), + "baseline_idle_mass": str(baseline_model["idle_mass"]), + "replacement_mass": str(changed_model["total_mass"]), + "replacement_idle_mass": str(changed_model["idle_mass"]), + "baseline_a_ceiling": [str(x) for x in baseline_bracket], + "plane_a_ceiling": [str(x) for x in changed_bracket], + "plane_at_1_over_99_relaxation_lower": str( + ceiling.relax(profile, m, families, stages, 40, target, + R=max_child, unpaid=2)[0]), + "unpriced_interface_obligations": [ + "physical plane-frame routes and transitions", + "streaming/register schedule and cleanup", + "owner hosting and whole-call placement", + "precision/tape and integration with the selected complex supplier", + ], + "controls": 4, + "kappa_claim": False, + } + + +if __name__ == "__main__": + result = check() + print(json.dumps(result, sort_keys=True, separators=(",", ":")))