diff --git a/research/centre-nonlinear-fresh-floor/README.md b/research/centre-nonlinear-fresh-floor/README.md new file mode 100644 index 0000000000..0f2520b927 --- /dev/null +++ b/research/centre-nonlinear-fresh-floor/README.md @@ -0,0 +1,106 @@ +# Nonlinear and adaptive centre sharing keeps the fresh-information floor + +**Scoped negative result; no new κ.** The selected record and frontier are unchanged. + +[centre-causal-tangent](../centre-causal-tangent/README.md) (#3873) proves its 1,152-query floor for uniform +causal *linear* scalar-oracle sharing and lists "a lower bound against nonlinear or adaptive algorithms" as +not established. [centre-history-innovation](../centre-history-innovation/README.md) proves that no decoder, +even nonlinear, of the earlier centre history recovers the call-10 query, and that a fresh *linear* +observation needs complex dimension `m >= 8d`; fresh *nonlinear* observations are left open there. + +This package closes that remaining case under the same premises: + +- **Theorem 1.** Any fresh observation that is continuous, or semialgebraic (finitely many branches built + from `+ - x`, division by nonzero values including the dyadic `/2, /4`, real constants, comparisons and + adaptive reads), still needs **at least 8d complex coordinates** per future owner, the same as the linear floor. +- **Theorem 2.** On a finite b-bit grid the only escape is packing several values into wider words + (Kronecker substitution). It conserves bits: the widths of the fresh coordinates sum to at least `16db`. + In the rank-mass model a k-times wider coordinate is a k-times larger child, so the coverage mass + `72w + 64` and deficit `w - 64` are unchanged. +- **Screen.** Regrouping the 64 centre mass into larger children, which bounds every packing, raises the + [complex-local-word ceiling](../complex-local-word-ceiling/README.md) by at most **+0.67%**, before guard bits, + carries, unpacking or hosting are charged. The card's two-call sharing budget (x1.90) needs the fresh + information halved, which Theorems 1–2 exclude. + +| Variant (centre mass 64 kept) | ceiling `a_hi` | x selected ceiling | +|---|---:|---:| +| selected: 8 x rank-8 | 0.00169005411 | 1.000000 | +| pack 2 totals: 4 x rank-16 | 0.00169362555 | 1.002113 | +| pack 4 totals: 2 x rank-32 | 0.00169720789 | 1.004233 | +| pack 8 totals: 1 x rank-64 | 0.00170080115 | 1.006359 | +| ideal regroup: fractional rank-72 | 0.00170141282 | 1.006721 | +| control: halved centre information (4 copies, charge 32) | 0.00321297289 | 1.901107 | + +Exact rational brackets are in [RESULT.json](RESULT.json). + +## Setting (inherited, not re-proved) + +From centre-history-innovation, under its native common-frame and full-space cover-view premises: +`H` (all centre fields of calls 0..9 at every owner) and `Q` (the eight pre-transport fields of call 10 at +common owner `I`) are complex-linear on input differences, and `Q(ker H) = M^8`, `dim_C = 8d`. +Fix a complex subspace `V ⊂ ker H` with `Q|_V : V -> M^8` bijective. `V` has real dimension `16d`. + +A sharing scheme for call 10 may use (1) the complete earlier history `H(x)` in any form, cached, +recombined or nonlinearly processed; (2) a fresh observation `E(x) ∈ R^n` (a complex coordinate counts as +two real ones), produced adaptively: which reads happen and what is computed may depend on `H(x)` and on +earlier fresh reads; (3) any decoder `D` with `D(H(x), E(x)) = Q(x)` on legal inputs. The "mutable +eight-slot cache with fresh reads" left open by the predecessor is an instance: the cache is a function +of `H`, the reads are `E`. + +## Proofs + +**Theorem 1.** On `V`, `H(x) = 0`, so the history gives no information and any adaptivity on it is one fixed +choice. `D(0, E(x)) = Q(x)` and `Q` is injective on `V`, hence `E` is injective on `V`. +Continuous case: no continuous injection of an open subset of `R^{16d}` into `R^n` exists for `n < 16d` +(invariance of domain / Borsuk–Ulam). Semialgebraic case: `V ∩ box` is the finite union of the semialgebraic +pieces on which the branches are fixed; one piece `P` has dimension `16d`; an injective semialgebraic map +preserves dimension, so `16d = dim E(P) <= n`. ∎ + +**Theorem 2.** The dimension argument fails only for maps with unboundedly many pieces, i.e. bit extraction +on an unbounded grid. On a grid `G ⊂ V` with `2^{16db}` points, `E` injective on `G` needs at least +`2^{16db}` distinct values, so the bit widths of its coordinates sum to at least `16db`. Kronecker packing +attains this, and one bit less collides (checked exhaustively on six small grids by `verify.py`). ∎ +That such a grid is a legal fixed-width input set is an inherited premise: the predecessor notes that scaling +its constant witness gives a bounded dyadic counterexample but supplies no fixed-width right inverse. + +## Scope and limits + +- All premises of centre-history-innovation are inherited (native common-frame contract, full-space cover + view, one future owner, call 10). Its verifier is replayed unchanged here; its compiler contracts are not rebuilt. +- This is an information floor. The step "8d fresh coordinates => 64 rank-mass units" is the separate + rank-8-per-channel carrier premise of #3918; nonlinearity does not change it, and the screen bounds what + any regrouping of that mass could gain. +- The screen uses the fixed selected local word, 112 ports, the nine-stage template and the coverage law. + Changed words, templates or coverage laws are outside it. +- A terminal-only consumer that never forms the internal call-10 query is a changed contract and is not covered. + +## Reproduce + +From the repository root (Python 3.12, standard library; about 35 s, mostly the predecessor replay): + +```sh +python3.12 -I -B research/centre-nonlinear-fresh-floor/verify.py +python3.12 scripts/research_package.py --package research/centre-nonlinear-fresh-floor +``` + +Expected: `PASS_CENTRE_NONLINEAR_FRESH_FLOOR premise=8edf9aec270e packing_best=x1.006721 controls=4 no_new_kappa`. +Controls: the halved-information lever reproduces x1.90; a rank-73 child, a mass-losing pack and a corrupted +predecessor digest are rejected. `--write` regenerates `RESULT.json`. + +## Open next questions + +Structured in [TASK.json](TASK.json): + +1. **Terminal-only consumer.** Can a changed consumer avoid forming the internal call-10 query? First step: + state the complete varying-source-and-target terminal map and test the 112 kernel witnesses of + centre-history-innovation. Blocked by: no priced changed terminal contract. +2. **Carrier premise.** Does `8d` fresh coordinates force 64 rank-mass units for carriers other than rank-8 + channels? First step: price one alternative carrier with its restoration and hosting bill. The screen + here caps its ideal gain at +0.67%. + +## Credit + +Builds directly on Jose Manuel (`jmbarrancoml`)'s centre-history-innovation and its credited lineage, +Clear1nsight's centre-causal-tangent (#3873), Douglas Colkitt's complex-local-word ceiling, the nonlinear +copy-floor line (#703, #785, #814, #888) and the centre-sharing budgets (#1791, #1888, #3075, #3548, #3948). +Prepared by Mark (Matarener) with substantial Claude (Anthropic) assistance. Apache-2.0. diff --git a/research/centre-nonlinear-fresh-floor/RESULT.json b/research/centre-nonlinear-fresh-floor/RESULT.json new file mode 100644 index 0000000000..a13c45a77b --- /dev/null +++ b/research/centre-nonlinear-fresh-floor/RESULT.json @@ -0,0 +1,125 @@ +{ + "base_commit": "12fa8c5c844be21bfefb38a19503fbd867a11244", + "best_packing_ratio": "1.006720916", + "controls": [ + [ + "halved_centre_information_x1.90", + "1606486447/500000000000", + "1.901107" + ], + [ + "rank_73_child_rejected" + ], + [ + "mass_losing_pack_rejected" + ], + [ + "corrupted_predecessor_digest_rejected" + ] + ], + "packing_sharpness": [ + [ + 2, + 1, + 4 + ], + [ + 2, + 2, + 16 + ], + [ + 2, + 3, + 64 + ], + [ + 3, + 1, + 8 + ], + [ + 3, + 2, + 64 + ], + [ + 4, + 1, + 16 + ] + ], + "predecessor_receipt": "8edf9aec270ec97d9800d097e6bd6feebab7b8d55d8b81b104a53fe8789f0cb4", + "screen": [ + { + "a_hi": "169005411/100000000000", + "a_lo": "1690054109/1000000000000", + "local": { + "1": "2412", + "2": "418", + "3": "432", + "4": "142", + "5": "82", + "8": "8" + }, + "name": "selected 8 x rank-8", + "ratio_hi": "1.000000000" + }, + { + "a_hi": "423406387/250000000000", + "a_lo": "1693625547/1000000000000", + "local": { + "1": "2412", + "16": "4", + "2": "418", + "3": "432", + "4": "142", + "5": "82" + }, + "name": "pack 2 totals: 4 x rank-16", + "ratio_hi": "1.002113209" + }, + { + "a_hi": "1697207887/1000000000000", + "a_lo": "848603943/500000000000", + "local": { + "1": "2412", + "2": "418", + "3": "432", + "32": "2", + "4": "142", + "5": "82" + }, + "name": "pack 4 totals: 2 x rank-32", + "ratio_hi": "1.004232869" + }, + { + "a_hi": "1700801149/1000000000000", + "a_lo": "425200287/250000000000", + "local": { + "1": "2412", + "2": "418", + "3": "432", + "4": "142", + "5": "82", + "64": "1" + }, + "name": "pack 8 totals: 1 x rank-64", + "ratio_hi": "1.006358991" + }, + { + "a_hi": "1701412821/1000000000000", + "a_lo": "85070641/50000000000", + "local": { + "1": "2412", + "2": "418", + "3": "432", + "4": "142", + "5": "82", + "72": "8/9" + }, + "name": "ideal regroup: fractional rank-72", + "ratio_hi": "1.006720916" + } + ] +} diff --git a/research/centre-nonlinear-fresh-floor/SOURCES.json b/research/centre-nonlinear-fresh-floor/SOURCES.json new file mode 100644 index 0000000000..b32bbfd83f --- /dev/null +++ b/research/centre-nonlinear-fresh-floor/SOURCES.json @@ -0,0 +1,84 @@ +{ + "schema_version": 1, + "base_commit": "12fa8c5c844be21bfefb38a19503fbd867a11244", + "files": [ + { + "path": "certificates/selected-result.json", + "usage": "provenance", + "git_blob": "b1fea0c94436b236cc2b7d41a7be032811b94c81", + "sha256": "bb2eaa58647b353f88d0aec2eafb9d30df1be53589231b23e12ceef3e4bad129" + }, + { + "path": "docs/research/agent-task-catalog.json", + "usage": "provenance", + "git_blob": "64bfc5af6709ed9811171e0a2108f05e1219cb65", + "sha256": "352a6184713b8843d96fd2c2071eb7aeaa655906b7c51d45ad444912666c8a96" + }, + { + "path": "research/centre-history-innovation/RESULT.json", + "usage": "input", + "git_blob": "441ab95422bc6d970f92816e52cf05bc0b8775df", + "sha256": "575970c3cf0c1aa8dfe22c5edfa22290b3b918b24ea8ecef55f9316a8edca399" + }, + { + "path": "research/centre-history-innovation/SOURCES.json", + "usage": "input", + "git_blob": "f9ab49e9a4f1c4671950821ee2f91242510405b1", + "sha256": "a5ed0e3437fb89a84f1f3141aa7278e208e5f22229b0f341a1a5ce12ecba4f4a" + }, + { + "path": "research/centre-history-innovation/VERIFY.json", + "usage": "input", + "git_blob": "34f798359708edf7397413a2603c454b97c71956", + "sha256": "9e56a60f94beb385c31da9690e34b3ec3bccb4f4e0d7775cd2df81b3ac193537" + }, + { + "path": "research/centre-history-innovation/verify.py", + "usage": "input", + "git_blob": "ae11fa6ccdba61db98bbac7b19bb5d2247d60097", + "sha256": "f0874ac671f3ac797a8834c6f4ee07a24800b19bda33c099aee31051fb1250b9" + }, + { + "path": "research/centre-native-observation-dimension/PROOF.md", + "usage": "input", + "git_blob": "ffe657f7e8a691b3dc3db5910cab8594b8b49285", + "sha256": "5f81f76cbb61e5d66ded17423045d02f959f182ada6158fd6428b3a909943b29" + }, + { + "path": "research/centre-native-terminal-factor/README.md", + "usage": "input", + "git_blob": "fa3eea91d01f0f67fc4122a9d21e1e7bf0ca48c7", + "sha256": "2fc637efd214ec00a57f23428d6a1decc11f144768baada9517b6f9d0a38b20a" + }, + { + "path": "research/community-frontier1094-audit/selected-replay.tar.gz", + "usage": "input", + "git_blob": "c24daf067f9c543421d89ca2eeaa4eb78a57fb6f", + "sha256": "f1da80610bf33c58527f18ad63b4350d0b864e1d4486141ee17ac9bed4d529d6" + }, + { + "path": "research/complex-local-word-ceiling/ceiling.py", + "usage": "input", + "git_blob": "6c0f54527d879396f689523bfde19928a9b6157c", + "sha256": "86a1432870b3b21d8454106ec9162fddc0471472d9214c590a1420f2426cedfc" + }, + { + "path": "research/idle-axis-hosting/PROOF.md", + "usage": "input", + "git_blob": "4468a00349b4f68dce103e785a8392099435e1d6", + "sha256": "cfe34bf0b64259661312dae22c3a23adc5bf6f6326951eee5c1488ccfc347542" + }, + { + "path": "research/selected-centre-native-lift/README.md", + "usage": "input", + "git_blob": "98721e3eb4b955129321078f09c4b1b3b2ef5ae0", + "sha256": "aa50f2984b8f0af8781e1b0295f907606b1031bc284a396b683f3e5506148595" + }, + { + "path": "research/split-centres-global/proofs/INHERITED-COMPLEX-GEOMETRY.txt", + "usage": "input", + "git_blob": "c4150cb693414c098690eae79b3aea5f47c184ff", + "sha256": "c1ff55536594222a8d2a30bc0e0956959774e1be2d5420b7838ad553ee556df2" + } + ] +} diff --git a/research/centre-nonlinear-fresh-floor/TASK.json b/research/centre-nonlinear-fresh-floor/TASK.json new file mode 100644 index 0000000000..e2e36d0f08 --- /dev/null +++ b/research/centre-nonlinear-fresh-floor/TASK.json @@ -0,0 +1,78 @@ +{ + "schema_version": 1, + "task_id": "centre-path-sharing", + "priority_revision": 7, + "base_commit": "12fa8c5c844be21bfefb38a19503fbd867a11244", + "original_card": { + "id": "centre-path-sharing", + "question": "Can the 64-per-call centre path (eight rank-8 COPY/ERASE totals through the private temporary) be shared across calls or shrunk?", + "starting_points": [ + "docs/research/research-family-status.md", + "research/complex-local-word-ceiling/README.md", + "research/split-centres-global/proofs/PR386-BIT-GEOMETRY.txt", + "certificates/selected-result.json" + ], + "methods": [ + "Derive a fully charged favorable relaxation for sharing one centre path across k calls, including restoration, hosting and precision.", + "Prove a lower bound on copied information per call for the selected decoder contract." + ], + "acceptance_gate": "Show the changed centre charge and copy profile per call with every added restoration or hosting cost charged, and its ceiling via ceiling.ceiling(centre=...). 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": "Write the per-call centre charge and copy children for sharing across k = 2 calls, charge the sharing overhead, and screen it; stop this route if even the ideal sharing gains under 10%. Ideal budgets: free 2.80x, shared by two 1.90x (levers.py).", + "bottleneck_link": "The centre path consumes 64 of about 99.6 unpaid coordinates per call, i.e. about 64% of the raw deficit.", + "allowed_variations": [ + "One sharing pattern across a fixed number of calls.", + "One reduced copied-total contract for the existing decoder.", + "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": [ + "Removing copies without a replacement contract for the decoder's copied totals.", + "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": [ + "centre path", + "copied totals", + "private temporary", + "shared centre", + "batching" + ] + }, + "scope_status": "refined", + "actual_scope": "Close the nonlinear/adaptive case left open by research/centre-causal-tangent (#3873) and the fresh nonlinear-observation case left open by research/centre-history-innovation: any continuous or semialgebraic (including dyadic division, branching and adaptive reads) fresh observation still needs 8d complex coordinates per future owner, and finite-precision packing conserves bits; price that packing in the complex-local-word ceiling.", + "scope_change_reason": "The card asks whether the centre can be shared or shrunk; existing floors are linear or cover only decoders of the earlier history. This package answers the card method 2 (copied-information lower bound) for the remaining nonlinear and adaptive fresh-data interfaces, and screens the only finite-precision escape (packing) with ceiling.ceiling, rather than constructing a sharing circuit.", + "bottleneck_link": "The centre path is 64 of about 99.6 unpaid coordinates per call; the x1.90 two-call sharing budget requires halving fresh centre information, which this package shows nonlinearity cannot do under the inherited premises.", + "budget_minutes": 240, + "stop_rule": "Stop at the information boundary: continuous/semialgebraic fresh observations need >=8d complex coordinates, packing conserves bits and its ideal ceiling gain is below the card 10% stop threshold.", + "outcome": "negative-result", + "evidence": "verify.py replays research/centre-history-innovation/verify.py unchanged (receipt 8edf9aec...), checks Kronecker-packing sharpness on six small grids, and computes exact ceiling brackets: best packing x1.006721 (fractional rank-72), 2/4/8-total packs x1.002113/x1.004233/x1.006359, versus the halved-information lever x1.901107. Passed on CPython 3.12 (Windows) with and without -O.", + "author": "Mark (Matarener)", + "ai_assistance": "Substantial Claude (Anthropic) assistance in proof, code and prose; no independent human or formal-kernel review.", + "open_questions": [ + { + "question": "Can a terminal-only consumer avoid forming the internal call-10 centre query?", + "why_it_matters": "Both this floor and its predecessor bind the internal query; a changed consumer contract is the remaining route to fewer fresh centre coordinates.", + "first_step": "State the complete varying-source-and-target terminal output map and evaluate it on the 112 kernel witnesses of centre-history-innovation.", + "blocked_by": "No changed terminal contract with priced consumer, restoration and hosting obligations is specified." + }, + { + "question": "Does the information floor (8d fresh complex coordinates) imply the 64-unit rank-mass charge for carriers other than rank-8 channels?", + "why_it_matters": "The step from coordinates to rank mass is the rank-8-per-channel carrier premise of #3918, independent of nonlinearity.", + "first_step": "Price one alternative carrier (e.g. one rank-16 child carrying two totals) with its restoration and hosting bill.", + "blocked_by": "No admitted alternative carrier contract; the screen here shows its ideal gain is at most +0.67%." + } + ], + "coordination": { + "canonical_main": "12fa8c5c844be21bfefb38a19503fbd867a11244", + "overlap": "Inspected PRs 3075, 3120, 3147, 3151, 3291, 3548, 3873, 3918, 3948, 1888, 785, 888 and packages centre-history-innovation, centre-causal-tangent, *-nonlinear-copy-floor; no nonlinear fresh-observation centre bound found. No novelty guarantee.", + "preservation": "Only the new package directory is added." + } +} diff --git a/research/centre-nonlinear-fresh-floor/VERIFY.json b/research/centre-nonlinear-fresh-floor/VERIFY.json new file mode 100644 index 0000000000..57ad9a50c8 --- /dev/null +++ b/research/centre-nonlinear-fresh-floor/VERIFY.json @@ -0,0 +1,42 @@ +{ + "schema_version": 1, + "status": "ready", + "python": "3.12", + "requirements": [], + "inputs": [ + "research/centre-history-innovation/RESULT.json", + "research/centre-history-innovation/SOURCES.json", + "research/centre-history-innovation/VERIFY.json", + "research/centre-history-innovation/verify.py", + "research/centre-native-observation-dimension/PROOF.md", + "research/centre-native-terminal-factor/README.md", + "research/community-frontier1094-audit/selected-replay.tar.gz", + "research/complex-local-word-ceiling/ceiling.py", + "research/idle-axis-hosting/PROOF.md", + "research/selected-centre-native-lift/README.md", + "research/split-centres-global/proofs/INHERITED-COMPLEX-GEOMETRY.txt" + ], + "commands": [ + { + "argv": [ + "{python}", + "-I", + "-B", + "{package}/verify.py" + ], + "timeout_seconds": 300, + "checks": "Source pins; unchanged predecessor centre-history-innovation replay and receipt; Kronecker packing sharpness on six grids; exact ceiling brackets for 2/4/8-total and ideal packing with mass conservation; four controls; RESULT.json byte match." + }, + { + "argv": [ + "{python}", + "-I", + "-O", + "-B", + "{package}/verify.py" + ], + "timeout_seconds": 300, + "checks": "Same replay under optimisation (all checks use explicit exceptions, not assert)." + } + ] +} diff --git a/research/centre-nonlinear-fresh-floor/verify.py b/research/centre-nonlinear-fresh-floor/verify.py new file mode 100644 index 0000000000..cf57413feb --- /dev/null +++ b/research/centre-nonlinear-fresh-floor/verify.py @@ -0,0 +1,160 @@ +#!/usr/bin/env python3 +"""Nonlinear/adaptive centre sharing: fresh-information floor and packing screen. + +Checks, from the repository root: +1. premise: replays research/centre-history-innovation/verify.py unchanged in an isolated + subprocess and binds its PASS line and receipt digest (Q(ker H) = M^8 under its premises); +2. sharpness of the finite-precision count (Theorem 2): on small dyadic grids, Kronecker packing + of k b-bit coordinates into one word is injective exactly when the word has >= k*b bits; +3. packing screen: exact ceiling brackets of research/complex-local-word-ceiling/ceiling.py for + regrouping the 64 centre mass into larger children, with mass conservation asserted; +4. controls: halving the centre information reproduces the x1.90 lever; a rank-73 child, a + mass-changing pack and a corrupted predecessor digest are rejected. + +usage: verify.py [--write] (--write regenerates RESULT.json) +Mark (Matarener), with substantial Claude (Anthropic) assistance. Apache-2.0. +""" +import argparse +import importlib.util +import itertools +import json +import subprocess +import sys +from fractions import Fraction as Q +from hashlib import sha256 +from pathlib import Path + +HERE = Path(__file__).resolve().parent +ROOT = HERE.parents[1] +PRED = ROOT / 'research/centre-history-innovation' +CEIL = ROOT / 'research/complex-local-word-ceiling/ceiling.py' +M, FAM, ST = 73, 896, 9 +WORD = {1: 2412, 2: 418, 3: 432, 4: 142, 5: 82, 8: 8} +GRID = Q(1, 10 ** 12) + + +def need(ok, message): + if not ok: + raise ValueError(message) + + +def check_sources(): + pins = json.loads((HERE / 'SOURCES.json').read_text(encoding='utf-8')) + for row in pins['files']: + if row['usage'] != 'input': + continue + raw = (ROOT / row['path']).read_bytes() + need(sha256(raw).hexdigest() == row['sha256'], 'source SHA256: ' + row['path']) + return pins['base_commit'] + + +def premise(): + """Replay the predecessor verifier and bind its receipt digest.""" + out = subprocess.run([sys.executable, '-I', '-B', str(PRED / 'verify.py')], cwd=ROOT, + capture_output=True, text=True, timeout=300) + need(out.returncode == 0, 'predecessor verifier failed: ' + out.stderr[-400:]) + line = out.stdout.strip().splitlines()[-1] + expected = json.loads((PRED / 'RESULT.json').read_text(encoding='utf-8'))['sha256'] + need(line == 'PASS_CENTRE_HISTORY_INNOVATION sha256=' + expected, 'predecessor receipt: ' + line) + return expected + + +def digest_matches(line, expected): + return line == 'PASS_CENTRE_HISTORY_INNOVATION sha256=' + expected + + +def packing_sharpness(): + """Kronecker packing of k b-bit values into one w-bit word: injective iff w >= k*b.""" + rows = [] + for k, b in [(2, 1), (2, 2), (2, 3), (3, 1), (3, 2), (4, 1)]: + vals = list(itertools.product(range(1 << b), repeat=k)) + for w in range(1, k * b + 1): + # best possible map into w bits: pigeonhole bound on distinct images + injective_possible = len(vals) <= (1 << w) + need(injective_possible == (w >= k * b), 'counting bound') + packed = {sum(v << (b * i) for i, v in enumerate(t)) for t in vals} + need(len(packed) == len(vals) and max(packed) < (1 << (k * b)), 'Kronecker packing attains k*b') + # the same packing truncated to k*b-1 bits collides + trunc = {p & ((1 << (k * b - 1)) - 1) for p in packed} + need(len(trunc) < len(vals), 'one bit short collides') + rows.append([k, b, len(vals)]) + return rows + + +def load_ceiling(): + spec = importlib.util.spec_from_file_location('imb_ceiling', CEIL) + mod = importlib.util.module_from_spec(spec) + spec.loader.exec_module(mod) + return mod + + +def screen(C): + def cap(local, centre=64): + return C.ceiling(local, M, FAM, ST, centre, grid=GRID) + + base_mass = sum(r * n for r, n in WORD.items()) + rest = {r: n for r, n in WORD.items() if r != 8} + cases = [('selected 8 x rank-8', WORD)] + for k in (2, 4, 8): + cases.append((f'pack {k} totals: {8 // k} x rank-{8 * k}', {**rest, 8 * k: Q(8, k)})) + cases.append(('ideal regroup: fractional rank-72', {**rest, 72: Q(64, 72)})) + rows = [] + base = None + for name, local in cases: + need(sum(r * Q(n) for r, n in local.items()) == base_mass, 'packing conserves mass: ' + name) + lo, hi = cap(local) + base = hi if base is None else base + rows.append(dict(name=name, local={str(r): str(n) for r, n in sorted(local.items())}, + a_lo=str(lo), a_hi=str(hi), ratio_hi=f'{float(hi / base):.9f}')) + best = max(Q(r['a_hi']) for r in rows) + need(best / base < Q(1007, 1000), 'packing ceiling below +0.7%') + return rows, best / base + + +def controls(C, base_hi): + out = [] + lo, hi = C.ceiling({**WORD, 8: 4}, M, FAM, ST, 32, grid=GRID) + ratio = hi / base_hi + need(Q(19, 10) < ratio < Q(191, 100), 'two-call halving lever reproduces x1.90') + out.append(['halved_centre_information_x1.90', str(hi), f'{float(ratio):.6f}']) + try: + C.ceiling({**{r: n for r, n in WORD.items() if r != 8}, 73: Q(64, 73)}, M, FAM, ST, 64, grid=GRID) + raise AssertionError('rank-73 child accepted') + except ValueError: + out.append(['rank_73_child_rejected']) + rest = {r: n for r, n in WORD.items() if r != 8} + try: + local = {**rest, 16: 2} # packs 8 totals into 2 rank-16 words: loses half the bits + need(sum(r * Q(n) for r, n in local.items()) == sum(r * n for r, n in WORD.items()), 'mass') + raise AssertionError('mass-losing pack accepted') + except ValueError: + out.append(['mass_losing_pack_rejected']) + need(not digest_matches('PASS_CENTRE_HISTORY_INNOVATION sha256=' + '0' * 64, '1' * 64), + 'corrupted digest rejected') + out.append(['corrupted_predecessor_digest_rejected']) + return out + + +def main(): + ap = argparse.ArgumentParser() + ap.add_argument('--write', action='store_true') + args = ap.parse_args() + base_commit = check_sources() + digest = premise() + sharp = packing_sharpness() + C = load_ceiling() + rows, best = screen(C) + ctl = controls(C, Q(rows[0]['a_hi'])) + result = dict(base_commit=base_commit, predecessor_receipt=digest, packing_sharpness=sharp, + screen=rows, best_packing_ratio=f'{float(best):.9f}', controls=ctl) + text = json.dumps(result, indent=1, sort_keys=True) + '\n' + path = HERE / 'RESULT.json' + if args.write: + path.write_text(text, encoding='utf-8', newline='\n') + need(path.read_text(encoding='utf-8') == text, 'RESULT.json mismatch (run with --write)') + print(f'PASS_CENTRE_NONLINEAR_FRESH_FLOOR premise={digest[:12]} packing_best=x{float(best):.6f} ' + f'controls={len(ctl)} no_new_kappa') + + +if __name__ == '__main__': + main()