From 044d9a28563d1e355c0c6d85455b90ecef761ffd Mon Sep 17 00:00:00 2001 From: Cinna Davis <1337isnot1337@users.noreply.github.com> Date: Sun, 18 Oct 2026 21:35:12 -0500 Subject: [PATCH] research: screen rank-2 block helper inventory --- .../README.md | 146 ++++++++++++++++ .../RESULT.json | 65 +++++++ .../SOURCES.json | 72 ++++++++ .../TASK.json | 66 +++++++ .../VERIFY.json | 31 ++++ .../verify.py | 163 ++++++++++++++++++ 6 files changed, 543 insertions(+) create mode 100644 research/complex-rank2-block-helper-screen/README.md create mode 100644 research/complex-rank2-block-helper-screen/RESULT.json create mode 100644 research/complex-rank2-block-helper-screen/SOURCES.json create mode 100644 research/complex-rank2-block-helper-screen/TASK.json create mode 100644 research/complex-rank2-block-helper-screen/VERIFY.json create mode 100644 research/complex-rank2-block-helper-screen/verify.py diff --git a/research/complex-rank2-block-helper-screen/README.md b/research/complex-rank2-block-helper-screen/README.md new file mode 100644 index 0000000000..3990143f4d --- /dev/null +++ b/research/complex-rank2-block-helper-screen/README.md @@ -0,0 +1,146 @@ +# Rank-2 block-helper inventory screen + +**Exploratory exact planning bound; no new supplier or selected kappa.** + +The pinned task/scope, source hashes and replay contract are in +[TASK.json](TASK.json), [SOURCES.json](SOURCES.json) and [VERIFY.json](VERIFY.json). + +## Question and contract + +Can the selected #1094 complex local word replace blocks of eight rank-1 +children implementing one 2-by-2 matrix product with one recursive rank-2 +helper, and what is the best optimistic moment if every eligible block is +replaced? + +The proposed helper contract is the ordinary map +`(A,B) -> AB` for two 2-by-2 matrices. Its schoolbook implementation uses +eight scalar products. If eight rank-1 children in the selected local word +form one complete, disjoint instance of that map, they can be represented as +one rank-2 recursive call. For `t` such blocks per call, the changed local +profile is + +```text +n1 = 2412 - 8t, n2 = 418 + t, +n3 = 432, n4 = 142, n5 = 82, n8 = 8, 0 <= t <= 301. +``` + +For `A=[[a,b],[c,d]]` and `B=[[e,f],[g,h]]`, the eight terms are +`ae,bg,af,bh,ce,dg,cf,dh`; the four outputs are respectively +`ae+bg`, `af+bh`, `ce+dg`, and `cf+dh`. Thus this is one coupled four-output +matrix product, not a direct sum of independent scalar products. + +Each block lowers the paid rank mass by six; the optimistic screen returns +those six units to the rank-51 idle remainder. It charges no block extraction, +input/output framing, addition, source restoration, hosting, precision, or +other consumer cost. The arithmetic therefore prices a proposed interface; it +does not show that its eight-term blocks occur in the selected word. + +## Exact screen + +The prescribed baseline example passes. The parent model has `m=73`, +`W=896/9` live families per call, nine stages, centre charge 64, and the +halving-guard idle rank cap `R=51`. The source-bound selected local profile is +`{1:2412, 2:418, 3:432, 4:142, 5:82, 8:8}` with local mass 5,586 and idle +mass 1,646. + +The best profile in this one-rewrite class uses all 301 complete blocks: + +```text +{1:4, 2:719, 3:432, 4:142, 5:82, 8:8} +local mass = 3,780; idle mass = 3,452; total = 7,232. +``` + +Using `ceiling.ceiling()` with exact rational intervals at grid `10^-12`, its +optimistic root is +`a in [0.002632122649, 0.002632122650]`, hence the complex-side planning cap +is `kappa <= 0.002625212768...`. The endpoint signs are certified by the +parent interval engine. Even this maximum inventory does not reach the +planning target `kappa=1/99`. + +The exact first point where this optimistic complex ceiling clears the +unchanged selected bit root is `t=22`: + +```text +{1:2236, 2:440, 3:432, 4:142, 5:82, 8:8} +local mass = 5,454; idle mass = 1,778. +``` + +At `a=bit_lower`, the previous inventory (`t=21`) has certified moment +strictly above one, and `t=22` has certified moment strictly below one. The +verifier prints the exact rational intervals for both signs. This is only a +zero-overhead threshold for source matching; it does not price the proposed +block extraction or its consumers. + +More importantly, with the selected bit supplier unchanged, the overall cap +is still the bit-side value `b/(1+b)`, where the selected assembly has +`b=1733427039589844234749/1000000000000000000000000`; this is below a 5% +increase over the selected `kappa=0.001672660197076918`. This helper change +alone cannot meet the 5% system target. It could matter only as part of work +that also raises the bit-side bound. + +For each `a>0`, replacing a block strictly lowers the relaxed moment because, +after factoring out `73^(-(1-a))`, its decrease is + +```text +8 - 2^(1-a) - 6*51^(-a) > 0. +``` + +The expression is zero at `a=0` and has positive derivative for `a>=0`. +Thus `t=301` is the best ceiling in this restricted rewrite class, not a +sampled point. + +## Reproduction + +From the repository root (Python standard library only): + +```sh +python3 -B research/complex-local-word-ceiling/verify.py +python3 -I -B research/complex-rank2-block-helper-screen/verify.py --check +``` + +The first command prints `PASS_COMPLEX_LOCAL_WORD_CEILING`. The second checks +the selected-source pins, the full per-call rank/idle bill, the exact root +bracket and both endpoint signs, the strict improvement over the original +ceiling, the unchanged bit cap, the 5% stop test, and out-of-range controls. +Neither command replays the complete selected construction. +Use `python3 -I -B research/complex-rank2-block-helper-screen/verify.py --write` +to regenerate the exact rational receipt `RESULT.json`. + +## Scope, source and credit + +Base: `20ecf2891d80b5acf18f980b2164fb44ea7faa90` (the session's pinned +canonical main). The +selected record is `certificates/selected-result.json`, kappa +`836330098538459/500000000000000000`; its reviewed source is +`docs/research/community-batch1099-review.md`, its assembly is +`research/community-frontier1094-audit/ASSEMBLY.json`, and its source manifest +is `research/community-frontier1094-audit/SELECTED-SOURCE.json`. The finite +coverage identity is attributed to PR #1012. The ceiling lemma and exact +interval engine are Douglas Colkitt's +`research/complex-local-word-ceiling/` contribution, prepared with Claude +(Anthropic) assistance. + +This screen does not find any complete eight-term block in the selected +producer, prove compatibility with its frames, or charge the physical +realization of a block. It does not admit a supplier, change kappa or the +selected frontier, or establish the full multiplication theorem. No +independent human review is claimed. Prepared with OpenAI Codex assistance. + +## Relation to nearby work + +This candidate changes one *complete* 2-by-2 matrix-product subword. It is +different from PR #1960's direct sums of consecutive independent rank-2/rank-3 +children, from the rank-one common-product/output-anchor claims in #1167, and +from PR #2224's six-coordinate `Q[S3]` convolution factorization. Those are +close block or bilinear mechanisms, so this package makes no novelty claim +beyond the exact object and moment screen stated here. It also differs from +PR #3874's combined ideal-lever grid: it changes the local parent subword and +releases the resulting six units of rank mass per block into idle capacity. + +## Open next questions + +Inspect the exact selected producer behind #1094 and determine whether even +one disjoint eight-term subword has the complete 2-by-2 input/output map above. +If so, price its frame, addition, restoration, hosting, and bit-side effects +before seeking more blocks. Otherwise stop this contract. Any continuation +must address the unchanged bit cap as well as the complex moment. diff --git a/research/complex-rank2-block-helper-screen/RESULT.json b/research/complex-rank2-block-helper-screen/RESULT.json new file mode 100644 index 0000000000..9a06d44429 --- /dev/null +++ b/research/complex-rank2-block-helper-screen/RESULT.json @@ -0,0 +1,65 @@ +{ + "base": "20ecf2891d80b5acf18f980b2164fb44ea7faa90", + "baseline_a_bracket_1e-12": [ + "1690054109/1000000000000", + "169005411/100000000000" + ], + "bit_b": "1733427039589844234749/1000000000000000000000000", + "bit_crossing_idle_mass": "1778", + "bit_crossing_local_mass": "5454", + "bit_crossing_profile_per_call": { + "1": 2236, + "2": 440, + "3": 432, + "4": 142, + "5": 82, + "8": 8 + }, + "bit_kappa_cap_upper": "1733427039589844234749/1001733427039589844234749", + "blocks_per_call_max": 301, + "candidate_a_bracket_1e-12": [ + "2632122649/1000000000000", + "52642453/20000000000" + ], + "candidate_moment_at_a_hi": [ + "115792089237429756355399434788156137141182667572608663281727707418166298314853/115792089237316195423570985008687907853269984665640564039457584007913129639936", + "57896044618714878177699717394078068570591333786304331640863853709083149157435/57896044618658097711785492504343953926634992332820282019728792003956564819968" + ], + "candidate_moment_at_a_lo": [ + "3618502788662927505738195365636877584726214511141390350157743396969395891349/3618502788666131106986593281521497120414687020801267626233049500247285301248", + "7237005577325855011476390731273755169452429022282780700315486793938791782699/7237005577332262213973186563042994240829374041602535252466099000494570602496" + ], + "candidate_moment_at_baseline_hi": [ + "28897204584848427825436451363931202947323668317080618356325526673841573167429/28948022309329048855892746252171976963317496166410141009864396001978282409984", + "28897204584848427825436451363931202947323668317080618356325526673841573167433/28948022309329048855892746252171976963317496166410141009864396001978282409984" + ], + "candidate_profile_per_call": { + "1": 4, + "2": 719, + "3": 432, + "4": 142, + "5": 82, + "8": 8 + }, + "complex_kappa_cap_upper": "52642453/20052642453", + "contract": "8 rank-1 scalar products -> 1 recursive rank-2 2x2 block helper", + "five_percent_system_target": "17562932069307639/10000000000000000000", + "idle_mass": "3452", + "local_mass": "3780", + "min_blocks_per_call_to_clear_bit_root": 22, + "moment_at_bit_root_first_crossing": [ + "115791433861598405212192388976899848948633134343156221001587985922425666556379/115792089237316195423570985008687907853269984665640564039457584007913129639936", + "57895716930799202606096194488449924474316567171578110500793992961212833278207/57896044618658097711785492504343953926634992332820282019728792003956564819968" + ], + "moment_at_bit_root_previous_blocks": [ + "115792126583934581881974895553767938252482618389908562191656991839663548837927/115792089237316195423570985008687907853269984665640564039457584007913129639936", + "57896063291967290940987447776883969126241309194954281095828495919831774418981/57896044618658097711785492504343953926634992332820282019728792003956564819968" + ], + "overall_cap_with_bit_fixed": "1733427039589844234749/1001733427039589844234749", + "planning_target_1_over_99": "1/99", + "scope": "optimistic profile only; source matching and extra physical charges are unproved", + "selected_kappa": "836330098538459/500000000000000000", + "selected_record_sha256": "bb2eaa58647b353f88d0aec2eafb9d30df1be53589231b23e12ceef3e4bad129", + "status": "PASS_RANK2_BLOCK_HELPER_SCREEN", + "total_coverage_mass": "7232" +} diff --git a/research/complex-rank2-block-helper-screen/SOURCES.json b/research/complex-rank2-block-helper-screen/SOURCES.json new file mode 100644 index 0000000000..aabe26311c --- /dev/null +++ b/research/complex-rank2-block-helper-screen/SOURCES.json @@ -0,0 +1,72 @@ +{ + "schema_version": 1, + "base_commit": "20ecf2891d80b5acf18d980b2164fb44ea7faa90", + "files": [ + { + "path": "certificates/checkpoints/frontier1042.json", + "usage": "input", + "git_blob": "f451ced6626a1f03aba6915ce23a136b01ebe51d", + "sha256": "207d1f49f113c585024b9d3c17eadbb8b1be17c1321e3d190aabe2f18ce1c5b7" + }, + { + "path": "certificates/selected-result.json", + "usage": "input", + "git_blob": "b1fea0c94436b236cc2b7d41a7be032811b94c81", + "sha256": "bb2eaa58647b353f88d0aec2eafb9d30df1be53589231b23e12ceef3e4bad129" + }, + { + "path": "docs/research/agent-task-catalog.json", + "usage": "provenance", + "git_blob": "67f085acd86acd7d4e03922d9cf4b26bca66fed5", + "sha256": "47b42433f5a85809a3aadd29c2c339da2c6ed728e4f7762df6b88bccb7874cf0" + }, + { + "path": "docs/research/community-batch1099-review.md", + "usage": "input", + "git_blob": "6cb6ec061a071a06a2d18cd4dc3e9a2b05d28099", + "sha256": "7e76d2c38e5fce30587835b7251df1430488ae4dd372611ef69a3f03f476b6cb" + }, + { + "path": "research/community-frontier1042-audit/ASSEMBLY.json", + "usage": "input", + "git_blob": "4e308dc23da97373d66e5d8d4a68b0661caea8e9", + "sha256": "093f35445812ea96fe1bfe6a3af7d769cb7f274e08f4fb30f71a17ed1161e54e" + }, + { + "path": "research/community-frontier1094-audit/ASSEMBLY.json", + "usage": "input", + "git_blob": "5fd676df060f3b450782fdf5ff5f6beb63a5eeb0", + "sha256": "1122cb3a575f8c788345fc1bf4c108ac7c3250fb81a5988671f5eb04b3ab3045" + }, + { + "path": "research/community-frontier1094-audit/INDEPENDENT1094.json", + "usage": "input", + "git_blob": "009a385e26858058a18188364078d162aa6f9519", + "sha256": "301fb8a0e4ab7e3c383ff974c54c08178283b2a3453c5282757f692a3c7a4bfd" + }, + { + "path": "research/community-frontier1094-audit/SELECTED-SOURCE.json", + "usage": "input", + "git_blob": "6a75493790b4eff9c4a98051ef8b01d6aad0d5a8", + "sha256": "79b3de5db3dbcb9829789ba58e9e45758926031e2a7d80667a08429d369be53b" + }, + { + "path": "research/complex-local-word-ceiling/README.md", + "usage": "input", + "git_blob": "f5f742f8196da29d2c3f4dffb3c27685ca9401f6", + "sha256": "b60be039cb0e03e064a27407d0bce9e58908d793da5ee405c876de5aebfa5f81" + }, + { + "path": "research/complex-local-word-ceiling/ceiling.py", + "usage": "input", + "git_blob": "6c0f54527d879396f689523bfde19928a9b6157c", + "sha256": "86a1432870b3b21d8454106ec9162fddc0471472d9214c590a1420f2426cedfc" + }, + { + "path": "research/complex-local-word-ceiling/verify.py", + "usage": "input", + "git_blob": "069f09de381a52ac91ec3edb372bd4536a051d91", + "sha256": "06b59955c69a2e7f49aa031d2ebaac2f39dbe107f4087122704f2a37ce9806d5" + } + ] +} diff --git a/research/complex-rank2-block-helper-screen/TASK.json b/research/complex-rank2-block-helper-screen/TASK.json new file mode 100644 index 0000000000..e7d7c1a755 --- /dev/null +++ b/research/complex-rank2-block-helper-screen/TASK.json @@ -0,0 +1,66 @@ +{ + "schema_version": 1, + "task_id": "complex-new-helper-inventory", + "priority_revision": 6, + "base_commit": "20ecf2891d80b5acf18d980b2164fb44ea7faa90", + "original_card": { + "id": "complex-new-helper-inventory", + "question": "Can a new local cost interface change the deficit-to-recursive-cost ratio beyond current packing?", + "starting_points": [ + "docs/research/research-family-status.md", + "research/complex-local-word-ceiling/README.md", + "research/heterogeneous-owner-assembly/README.md", + "certificates/selected-result.json", + "research/selected-k8-unrestricted-ends/README.md" + ], + "methods": [ + "Propose a changed helper inventory and derive an optimistic exact moment.", + "Design a small completed instance and independently verify its endpoint and rank bill." + ], + "acceptance_gate": "A new physically realizable contract outside the frozen catalogue whose per-call profile, screened with ceiling.ceiling(), beats the selected word's packing ceiling; a lower cap does not establish identical circuitry or order attainable optima, and is insufficient to pass the stronger-budget target under this model. A scoped local result may be retained without a complete supplier. Expanding it into further construction rounds requires the family-level budget and obligation gate in research-family-status.md; an optimistic passing relaxation alone is not acceptance.", + "first_step": { + "command": [ + "python3", + "-B", + "research/complex-local-word-ceiling/verify.py" + ], + "expected": "PASS_COMPLEX_LOCAL_WORD_CEILING", + "inspect": "Read the selected word's per-call local profile, its packing ceiling and the lever table; run levers.py for the ideal budget of the lever you target.", + "scope": "Positive control and planning budget only; this is not a new construction or full cold replay." + }, + "first_experiment": "Before any synthesis, write the candidate per-call local profile (and centre charge / unpaid coordinates if changed) and screen it with ceiling.ceiling(); reject it if even the ideal ceiling does not beat the selected word's by your stated margin.", + "bottleneck_link": "Packing of the selected word is capped at +0.87% (ceiling model); only a lower local excess spend or a changed coverage law raises the cap.", + "allowed_variations": [ + "Narrow to one changed boundary or helper type with explicit counts.", + "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": [ + "Mixing only providers already inside the pinned catalogue.", + "Only changing helper terminal subspaces and monotone frames within the fixed scalar word, entrances and cleanup contract already covered by #1995/#2013.", + "Continuing a partial cost improvement while leaving the same unpriced consumer, restoration or central-readout obligation unresolved; refresh the family expansion decision first. Local product-retiming evidence has a narrow scope and is not a ban on changed graphs or contracts." + ], + "overlap_terms": [ + "helper inventory", + "heterogeneous-owner", + "mutable leaver" + ] + }, + "scope_status": "refined", + "actual_scope": "Screen the new complete 2x2 matrix-product helper contract: replace eight rank-1 children by one rank-2 recursive helper; derive the best exact optimistic moment under the selected 73/896/9/64 coverage model and stop at the unchanged bit cap.", + "scope_change_reason": "Narrow the card to one coupled four-output M(2) bilinear subword, distinct from PR3874 ideal lever-grid enumeration, PR1960 independent direct-sum blocks, and earlier common-product output-anchor work. The verifier gives an optimistic profile screen; selected-source occurrence and physical charges remain open.", + "bottleneck_link": "The selected complex word ceiling is limited by paid rank-1 mass under PR1012 coverage. This M(2) subword would replace eight rank-1 children with one rank-2 child, releasing six rank-mass units per complete block to ideal rank-51 idle capacity.", + "budget_minutes": 60, + "stop_rule": "Stop after the exact maximum t=301 inventory and bit-root threshold are certified. The maximum complex cap remains below 1/99, and an unchanged bit supplier keeps the overall cap below the 5% system target. Reopen only with a source-mapped complete block and a changed bit-side route.", + "outcome": "partial", + "evidence": "PASS_RANK2_BLOCK_HELPER_SCREEN: exact root bracket [2632122649/1000000000000, 52642453/20000000000] at t=301; first bit-root crossing t=22; source occurrence and physical charges unproved.", + "author": "OpenAI Codex, homelab-06", + "ai_assistance": "Research and verifier prepared with GPT-6 Luna xhigh via OpenAI Codex; independent human review is unclaimed.", + "open_questions": [ + { + "question": "Does the source-bound #1094 local word contain at least 22 disjoint complete schoolbook M(2) subwords per call, with the required frames and restoration?", + "why_it_matters": "The exact zero-cost screen needs 22 substitutions per call merely to move the complex root above the selected bit root; physical charges could erase that headroom, and the unchanged bit supplier still blocks a 5% system gain.", + "first_step": "Trace the selected producer source and annotate each rank-1 child input/output pair; search for the exact eight-term 2x2 map in its two orientations.", + "blocked_by": "The selected assembly/profile does not encode ordered source expressions and frame/consumer mappings for these candidate groups in this package." + } + ] +} diff --git a/research/complex-rank2-block-helper-screen/VERIFY.json b/research/complex-rank2-block-helper-screen/VERIFY.json new file mode 100644 index 0000000000..638e475d8a --- /dev/null +++ b/research/complex-rank2-block-helper-screen/VERIFY.json @@ -0,0 +1,31 @@ +{ + "schema_version": 1, + "status": "ready", + "python": "3.12", + "requirements": [], + "inputs": [ + "certificates/checkpoints/frontier1042.json", + "certificates/selected-result.json", + "docs/research/community-batch1099-review.md", + "research/community-frontier1042-audit/ASSEMBLY.json", + "research/community-frontier1094-audit/ASSEMBLY.json", + "research/community-frontier1094-audit/INDEPENDENT1094.json", + "research/community-frontier1094-audit/SELECTED-SOURCE.json", + "research/complex-local-word-ceiling/README.md", + "research/complex-local-word-ceiling/ceiling.py", + "research/complex-local-word-ceiling/verify.py" + ], + "commands": [ + { + "argv": [ + "{python}", + "-I", + "-B", + "{package}/verify.py", + "--check" + ], + "timeout_seconds": 120, + "checks": "Source pins, selected per-call profile, coverage mass, exact moment bracket endpoint signs, minimal t=22 crossing of the selected bit root, 5% and 1/99 stop tests, and invalid block-count control." + } + ] +} diff --git a/research/complex-rank2-block-helper-screen/verify.py b/research/complex-rank2-block-helper-screen/verify.py new file mode 100644 index 0000000000..37bb3d5faf --- /dev/null +++ b/research/complex-rank2-block-helper-screen/verify.py @@ -0,0 +1,163 @@ +#!/usr/bin/env python3 +"""Exact optimistic screen for replacing eight rank-1 terms by one rank-2 block call.""" + +from fractions import Fraction as Q +import hashlib +import json +from pathlib import Path +import sys + +ROOT = Path(__file__).resolve().parents[2] +BASE = "20ecf2891d80b5acf18f980b2164fb44ea7faa90" +PINS = { + "certificates/selected-result.json": "bb2eaa58647b353f88d0aec2eafb9d30df1be53589231b23e12ceef3e4bad129", + "docs/research/community-batch1099-review.md": "7e76d2c38e5fce30587835b7251df1430488ae4dd372611ef69a3f03f476b6cb", + "research/community-frontier1094-audit/ASSEMBLY.json": "1122cb3a575f8c788345fc1bf4c108ac7c3250fb81a5988671f5eb04b3ab3045", + "research/community-frontier1094-audit/SELECTED-SOURCE.json": "79b3de5db3dbcb9829789ba58e9e45758926031e2a7d80667a08429d369be53b", + "research/community-frontier1094-audit/INDEPENDENT1094.json": "301fb8a0e4ab7e3c383ff974c54c08178283b2a3453c5282757f692a3c7a4bfd", + "research/complex-local-word-ceiling/ceiling.py": "86a1432870b3b21d8454106ec9162fddc0471472d9214c590a1420f2426cedfc", + "research/complex-local-word-ceiling/verify.py": "06b59955c69a2e7f49aa031d2ebaac2f39dbe107f4087122704f2a37ce9806d5", +} + +sys.path.insert(0, str(ROOT / "research" / "complex-local-word-ceiling")) +import ceiling as C # noqa: E402 +import verify as selected_ceiling # noqa: E402 + +GRID = Q(1, 10**12) +EXPECTED_LOCAL = {1: 2412, 2: 418, 3: 432, 4: 142, 5: 82, 8: 8} + + +def require(ok, why): + if not ok: + raise AssertionError(why) + + +def candidate(local, t): + max_t = local.get(1, 0) // 8 + require(isinstance(t, int) and 0 <= t <= max_t, "block count outside complete rank-1 groups") + out = dict(local) + out[1] = out.get(1, 0) - 8 * t + out[2] = out.get(2, 0) + t + return {r: n for r, n in out.items() if n} + + +def main(): + for rel, expected in PINS.items(): + actual = hashlib.sha256((ROOT / rel).read_bytes()).hexdigest() + require(actual == expected, f"source hash changed: {rel}") + + rec, asm, _, _, calls, live, local = selected_ceiling.selected() + require(local == EXPECTED_LOCAL, "selected per-call paid profile changed") + require(rec["audited_source_head"] == "0fc329d0bec93ca7cd288eaea1295172e8789810", + "selected audited source head changed") + require(calls % 9 == 0 and live == Q(896 * calls, 9), "selected call/live binding changed") + + baseline_model = C.model(local, 73, 896, 9, 64) + require(baseline_model["R"] == 51 and baseline_model["idle_mass"] == 1646, + "baseline coverage or halving-guard bill changed") + total_mass = baseline_model["total_mass"] + require(total_mass == 7232 and baseline_model["local_mass"] == 5586, + "baseline paid mass changed") + + base_lo, base_hi = C.ceiling(local, 73, 896, 9, 64, grid=GRID) + tmax = local[1] // 8 + changed = candidate(local, tmax) + changed_model = C.model(changed, 73, 896, 9, 64) + require(tmax == 301 and changed == {1: 4, 2: 719, 3: 432, 4: 142, 5: 82, 8: 8}, + "maximal candidate inventory changed") + require(changed_model["local_mass"] == 3780 and changed_model["idle_mass"] == 3452, + "candidate rank/idle bill changed") + require(changed_model["local_mass"] + changed_model["idle_mass"] == total_mass, + "candidate does not conserve the coverage mass") + + changed_lo, changed_hi = C.ceiling(changed, 73, 896, 9, 64, grid=GRID) + at_base = C.relax(changed, 73, 896, 9, 64, base_hi) + at_lo = C.relax(changed, 73, 896, 9, 64, changed_lo) + at_hi = C.relax(changed, 73, 896, 9, 64, changed_hi) + require(at_base[1] < 1, "candidate does not strictly improve the baseline ceiling") + require(at_lo[1] < 1 and at_hi[0] > 1, "candidate root bracket signs are not certified") + + bit_b = Q(asm["bit_lower"]) + bit_kappa_cap = bit_b / (1 + bit_b) + complex_kappa_cap = changed_hi / (1 + changed_hi) + selected_kappa = Q(rec["kappa"]) + five_percent_target = selected_kappa * Q(105, 100) + planning_target = Q(1, 99) + overall_cap = min(bit_kappa_cap, complex_kappa_cap) + + # Locate the first complete-block count whose complex root clears the unchanged bit root. + lo_t, hi_t = 0, tmax + while hi_t - lo_t > 1: + mid_t = (lo_t + hi_t) // 2 + if C.relax(candidate(local, mid_t), 73, 896, 9, 64, bit_b)[1] < 1: + hi_t = mid_t + else: + lo_t = mid_t + cross_profile = candidate(local, hi_t) + before_bit = C.relax(candidate(local, hi_t - 1), 73, 896, 9, 64, bit_b) + at_bit = C.relax(cross_profile, 73, 896, 9, 64, bit_b) + cross_model = C.model(cross_profile, 73, 896, 9, 64) + require(before_bit[0] > 1 and at_bit[1] < 1, + "minimal bit-cap crossing is not certified on both adjacent counts") + require(complex_kappa_cap < planning_target, "candidate unexpectedly reaches 1/99") + require(overall_cap < five_percent_target, "candidate unexpectedly clears the 5% system target") + require(bit_kappa_cap < five_percent_target < planning_target, "bit-side stop test changed") + + # One replacement strictly decreases the relaxed moment for every a > 0: + # 8 - 2^(1-a) - 6*51^(-a) has value zero at a=0 and positive derivative. + require(candidate(local, 0) == local, "zero-block candidate control failed") + try: + candidate(local, tmax + 1) + except AssertionError as exc: + require(str(exc) == "block count outside complete rank-1 groups", + "out-of-range block control failed for the wrong reason") + else: + raise AssertionError("out-of-range block count was accepted") + + result = { + "status": "PASS_RANK2_BLOCK_HELPER_SCREEN", + "base": BASE, + "selected_record_sha256": PINS["certificates/selected-result.json"], + "selected_kappa": str(selected_kappa), + "baseline_a_bracket_1e-12": [str(base_lo), str(base_hi)], + "contract": "8 rank-1 scalar products -> 1 recursive rank-2 2x2 block helper", + "blocks_per_call_max": tmax, + "candidate_profile_per_call": {str(k): v for k, v in sorted(changed.items())}, + "local_mass": str(changed_model["local_mass"]), + "idle_mass": str(changed_model["idle_mass"]), + "total_coverage_mass": str(total_mass), + "candidate_a_bracket_1e-12": [str(changed_lo), str(changed_hi)], + "candidate_moment_at_baseline_hi": [str(at_base[0]), str(at_base[1])], + "candidate_moment_at_a_lo": [str(at_lo[0]), str(at_lo[1])], + "candidate_moment_at_a_hi": [str(at_hi[0]), str(at_hi[1])], + "complex_kappa_cap_upper": str(complex_kappa_cap), + "min_blocks_per_call_to_clear_bit_root": hi_t, + "bit_crossing_profile_per_call": {str(k): v for k, v in sorted(cross_profile.items())}, + "bit_crossing_local_mass": str(cross_model["local_mass"]), + "bit_crossing_idle_mass": str(cross_model["idle_mass"]), + "moment_at_bit_root_previous_blocks": [str(before_bit[0]), str(before_bit[1])], + "moment_at_bit_root_first_crossing": [str(at_bit[0]), str(at_bit[1])], + "bit_b": str(bit_b), + "bit_kappa_cap_upper": str(bit_kappa_cap), + "overall_cap_with_bit_fixed": str(overall_cap), + "five_percent_system_target": str(five_percent_target), + "planning_target_1_over_99": str(planning_target), + "scope": "optimistic profile only; source matching and extra physical charges are unproved", + } + rendered = json.dumps(result, indent=2, sort_keys=True) + "\n" + args = sys.argv[1:] + receipt = Path(__file__).with_name("RESULT.json") + if args == ["--write"]: + receipt.write_text(rendered, encoding="utf-8", newline="\n") + print("WROTE_RANK2_BLOCK_HELPER_RESULT") + elif args == ["--check"]: + require(json.loads(receipt.read_text()) == result, "RESULT.json differs from recomputed evidence") + print("PASS_RANK2_BLOCK_HELPER_SCREEN") + print(rendered, end="") + else: + require(not args, "usage: verify.py [--write|--check]") + print(rendered, end="") + + +if __name__ == "__main__": + main()