diff --git a/research/qq16-interior-dynamic-range-and-adjoint-ledger/CREDITS.md b/research/qq16-interior-dynamic-range-and-adjoint-ledger/CREDITS.md new file mode 100644 index 0000000000..304886b991 --- /dev/null +++ b/research/qq16-interior-dynamic-range-and-adjoint-ledger/CREDITS.md @@ -0,0 +1,28 @@ +# Credits and Provenance + +## Package Authors + +- `dcharb78, with AI assistance` — package design, full 712-column algebraic replay (`224` data + `480` dirty helpers + `8` private `C` registers) across all 37 `CONSERVED-QQ16` native invocations (`F_0`, `F_1..F_8`, `B_1_2..B_7_8`), exact backward adjoint error-propagation ledger (`child`, `add`, `scale`, and combined gate gains), common dyadic grid exactness verification (`1/16` in `F`, `1/131072` in `B`), coupling to the `#2965` producer-defect transfer law, and physical recursive bill evaluation under `ceiling.ceiling(...)`. + +## Upstream Repository and Baseline Line + +- **CrocSwap / `integer-mult-bounds` maintainers and contributors** — repository architecture, `certificates/selected-result.json` baseline (`git_blob: b1fea0c94436b236cc2b7d41a7be032811b94c81`, `sha256: bb2eaa58647b353f88d0aec2eafb9d30df1be53589231b23e12ceef3e4bad129`, $\kappa = 0.001672660197076918$, `T37`/`T16`), `docs/research/agent-task-catalog.json` (`git_blob: 67f085acd86acd7d4e03922d9cf4b26bca66fed5`, `sha256: 47b42433f5a85809a3aadd29c2c339da2c6ed728e4f7762df6b88bccb7874cf0`, `task_id = "joint-query-controller"`, Priority Revision 6, base commit `997e6a9ca7b4f95d50e366f61412fd640d72a88a`), and `docs/research/current-priorities.md` single-move negative controls. + +## Direct Predecessors and Pinned Inputs (`SOURCES.json`) + +1. **Douglas Colkitt** (`#2697`, `#2707`, `#2736`, `#2932`, `#2959`, `#2965`, all `merged_for_archive_only` / `partially_reviewed`) — + - **`research/joint-query/` (`#2697`, `CONSERVED-QQ16`, `merged_for_archive_only` / `partially_reviewed`):** Constructed the native-`F17` conserved-helper producer certificate `research/joint-query/certificate.json.gz` (`git_blob: c6e876d8b48d768214deee265ade428f8983b566`, `sha256: a5ed85fac5ebf3c091482a113ab0d351eb5a7892fe2841a35e16017ec1ff49f7`) and summary `research/joint-query/evidence/CONSERVED-QQ16.json` (`git_blob: 7a155a27dcf7f1ccd48e40d57a2c5d2724016e9b`, `sha256: b91eb8599c403db55c889bb225a1cd93f46fdb83eb339f101d18843d52b1c920`), which reports (author-checked, `merged_for_archive_only` / `partially_reviewed`) the `480`-helper restoration and `8`-private-register zeroing laws with `55`-bit (`F`) and `73`-bit (`B`) triangle-inequality Horner bounds (`5413950274051752469/256` and `573411134169296526275133/64`). + - **`research/qq16-line-normalized-decoder/` (`#2707`, `merged_for_archive_only` / `partially_reviewed`):** Constructed the `3,823`-event line-normalized `224`-column `Q_Q16` two-sided decoder (`RESULT.json` `git_blob: ba4167dbf133cff51513bb832802c290edcdffea`, `sha256: 58df4ad68e2ff335ee58fa4336a449d0f73f3366d840574e5e30b50f507c358d`) using `336` rank-1 lines, `464` cover maps, `2,704` scalar adds (`1,808` `unit_ADD`, `896` `quarter_ADD`), and `312` clears. + - **`research/complex-local-word-ceiling/` (`#2736`, `#2932`, `#2959`, `merged_for_archive_only` / `partially_reviewed`):** Developed the exact rational interval packing-independent local-word ceiling screen `ceiling.py` (`git_blob: 6c0f54527d879396f689523bfde19928a9b6157c`, `sha256: 86a1432870b3b21d8454106ec9162fddc0471472d9214c590a1420f2426cedfc`) and `RESULT.json` (`git_blob: 77f55043a679dd722330f1e2499863e36376d9f9`, `sha256: d91d6c46509875abf1f61de67c2609656d3dc685451299f83caa6f922493692d`). + - **`research/qq16-producer-defect-transfer/` (`#2965`, `merged_for_archive_only` / `partially_reviewed`):** Derived the terminal producer-defect transfer law $\delta_R = D(F_0^{-1}\varepsilon_F + \varepsilon_B)$ (`RESULT.json` `git_blob: abe7e44c1d75edaef4c4407aa57a0f94faa949e6`, `sha256: d3992b63f7e576a52be846497d37f71a03e89d9481f82d1013743db05dc79cba`; `verify.py` `git_blob: 8dd78e9e36acb63451eae88c3c558f7f9afc348a`, `sha256: 1458d3a188a8ec0124e6edd1fdc7d9238c41d7a547fa2c00229763fc698e46c8`) with $\|F_0^{-1}\|_{\infty\to\infty} = 49$, $\|D\|_{\infty\to\infty} = 1923$, and normalized error bound `7587/8192`. + +2. **Prior Joint-Query, Decoder, and Frontier Lineage (`#845`–`#2876`)** — + - **`#845`, `#1012`, `#1094`, `#1098`, `#1240`:** Established the nine-stage hosted coverage law, the `centre = 64` per-call rank-8 centre tax, the `T37`/`T16` frontier line, and the `F17` Fourier/Hadamard endpoint conventions. + - **`#1659`, `#1708`, `#1712`, `#1748`, `#1791`, `#1829`, `#1918`, `#1969`, `#2048`, `#2199`, `#2391`:** Developed the retained recursive controller interfaces, `Q_Q16` (`224`-column) query-bundle reductions (`#1969`, `merged_for_archive_only` / `partially_reviewed`), and dirty-helper restoration templates. + - **`#2540`, `#2678`, `#2681` (Wimuks, Douglas Colkitt, and contributors, `merged_for_archive_only` / `partially_reviewed`):** Built the initial `Q_Q16` two-sided decoder words (`#2540` with `224` $H_1$ + `16` $H_8$; `#2678` rank-9 $H_9$ endpoint tariff; `#2681` with `448` $H_8$ removed and `224` $H_1$ added) that `#2707` normalized into `336` rank-1 lines. + - **`#2771`, `#2807`, `#2811`, `#2873`, `#2876`:** Investigated complex-local-word ceiling obstructions, `F17` endpoint adapter invoices (`224` $H_9$ lines), and two-call pair scheduling. + +3. **External Comparators: Concurrent Open PR Landscape (`#2995`, `#3017`, `#3036`, `#3068`, Not in `SOURCES.json`, Not Used as Input)** — + - **External comparator `#2995` and `#3017` (`Wimuks`, not in `SOURCES.json`, not used as input):** Reports (author-checked) forward dyadic rounding of `F_0` on the `224` data columns (`L[0..223]`), reporting `131072` ($2^{17}$) peak data $\ell_1$ norm, `16` max denominator, `132` child gain, `66311/4` scale gain, and the single-event rounding fault at `F_0` event `24,438` (`L[128] += (-1/2)*L[112]`). + - **External comparator `#3036` and `#3068` (`Goodhill1`, not in `SOURCES.json`, not used as input):** Reports (author-checked) dirty helper child counts in `F_0` (`2,950` of `3,494` children reading dirty helpers `L[224..703]`) and helper-dirt cancellation sites at events `3,887` and `4,060` (`L[72] += (-1/2)*L[328]`). + - **How this package advances beyond external comparators `#2995`, `#3017`, `#3036`, and `#3068` (not in `SOURCES.json`, not used as input):** Whereas those concurrent open PRs audited only `F_0` or forward rounding faults on individual instructions, this package performs the complete **712-column exact algebraic replay (`224` data + `480` dirty helpers + `8` private `C` registers)** across **all 37 native `CONSERVED-QQ16` programs** (`9` `F_s` + `28` `B_{s,t}`), establishes (report, author-checked) the **52-bit interior dynamic range collapse in `B`** (`73 -> 21` bits, peak $\ell_1 = 1154896$) alongside the **37-bit collapse in `F`** (`55 -> 18` bits, peak $\ell_1 = 131072`), constructs the **exact backward adjoint error-propagation ledger** for both `F` and `B` across all `704` outputs (`224` data + `480` restored helpers), establishes **Wrapper-Helper Adjoint Isolation** (`helpers_wrapper_child_gain = 0`), establishes that **common dyadic grid execution (`1/16` in `F`, `1/131072` in `B`) makes all `21,025` (`F`) and `21,401` (`B`) scalar gates exact (`eps_gate = 0`)**—eliminating the rounding faults of external comparators `#2995`/`#3017`/`#3036`/`#3068` and yielding a **`50 + \beta`-bit fixed-point floor**—and screens the physical recursive bill under `ceiling.ceiling(...)`. diff --git a/research/qq16-interior-dynamic-range-and-adjoint-ledger/MANIFEST.json b/research/qq16-interior-dynamic-range-and-adjoint-ledger/MANIFEST.json new file mode 100644 index 0000000000..e8e109be97 --- /dev/null +++ b/research/qq16-interior-dynamic-range-and-adjoint-ledger/MANIFEST.json @@ -0,0 +1,9 @@ +{ + "CREDITS.md": "0bd0af3948f191570250a0718b08a05782322511f2cee4b1439d73e595424edb", + "README.md": "2d2284bcb33cc437a9d3e03eaf93ca1ebfef4ced52fdb5d727a79970eab3b61b", + "RESULT.json": "f24537e48fead1189555d1e9cdbf881aa1c0022c4ed0c033baaf1cf9c131dc29", + "SOURCES.json": "930a40461df19290d5865d77569e7781cf314fbbb11bf62e484cc22427f90a01", + "TASK.json": "f5c80d67a707537fa033d2306d5c65789d1e44dc1d8deaeefea566fa1fe370bf", + "VERIFY.json": "fcc847522bfe8ce1f73fa4cb3d98de143e597b15b0d853cae6a39de6952c1f07", + "verify.py": "40238fe46cb6d416f0a277a3d0e531b79222f207f6904d6e3586f590ec1d1b27" +} diff --git a/research/qq16-interior-dynamic-range-and-adjoint-ledger/README.md b/research/qq16-interior-dynamic-range-and-adjoint-ledger/README.md new file mode 100644 index 0000000000..b2408a73cd --- /dev/null +++ b/research/qq16-interior-dynamic-range-and-adjoint-ledger/README.md @@ -0,0 +1,162 @@ +# Exact 712-Column Interior Dynamic Range Collapse (`55 -> 18` Bits in `F`, `73 -> 21` Bits in `B`), Backward Adjoint Error-Propagation Ledger, and Physical Recursive Bill for `CONSERVED-QQ16` + +**Status:** `PASS_QQ16_INTERIOR_DYNAMIC_RANGE_AND_ADJOINT_LEDGER` — report (author-checked), no new $\kappa$ claimed (`no_new_kappa`). +**Authors:** `dcharb78, with AI assistance` +**Target Task:** `joint-query-controller` (`track = "recursive-interfaces"`, weight `20`, Priority Revision `6` in `docs/research/current-priorities.md` and `docs/research/agent-task-catalog.json`, `base_commit = "997e6a9ca7b4f95d50e366f61412fd640d72a88a"`, `scope_status = "unchanged"`) +**Selected Baseline:** `certificates/selected-result.json` ($\kappa = 0.001672660197076918$, `T37`/`T16`, unchanged exact auditor). +**Provenance Boundary:** Pinned verification inputs (`SOURCES.json`, actual parent lineage) are loaded and SHA-256/git-blob verified at runtime (`#2697`, `#2707`, `#2736`, `#2932`, `#2959`, `#2965`; note that `#1969`, `#2540`, `#2678`, `#2681`, `#2697`, `#2707`, `#2736`, `#2932`, `#2959`, and `#2965` carry `merged_for_archive_only` / `partially_reviewed` status in `docs/research/pr-intake-decisions.json`); concurrent open PRs (`#2995`, `#3017`, `#3036`, `#3068`) are not in `SOURCES.json` and are not read at runtime, serving solely as external comparators / comparison benchmarks. + +--- + +## 1. Executive Summary + +Prior archived (`merged_for_archive_only` / `partially_reviewed`) `joint-query-controller` packages reported (author-checked): +- the native-`F17` conserved-helper producer certificate `CONSERVED-QQ16` (`#2697`, `research/joint-query/certificate.json.gz` and `research/joint-query/evidence/CONSERVED-QQ16.json`), which recorded path-sum triangle-inequality Horner bounds of **`55` bits** in `F` (`5413950274051752469/256`) and **`73` bits** in `B` (`573411134169296526275133/64`); +- the `3,823`-event line-normalized `224`-column `Q_Q16` two-sided decoder (`#2707`, `research/qq16-line-normalized-decoder/RESULT.json`); +- the terminal producer-defect transfer law $\delta_R = D(F_0^{-1}\varepsilon_F + \varepsilon_B)$ (`#2965`, `research/qq16-producer-defect-transfer/RESULT.json`) with $\|F_0^{-1}\|_{\infty\to\infty} = 49$, $\|D\|_{\infty\to\infty} = 1923$, and normalized error budget `7587/8192 < 1` whenever $\|\varepsilon_F\|_\infty \le H\cdot 2^{-\beta-8}$ and $\|\varepsilon_B\|_\infty \le H\cdot 2^{-\beta-13}$. + +However, `#2965` explicitly left open the **interior fixed-point precision and backward error-propagation ledger** across the `21,025` (`F`) and `21,401` (`B`) scalar gates and the `3,494` (`F`) and `3,510` (`B`) native children of `CONSERVED-QQ16`. Subsequent open PRs (`#2995` and `#3017` by `Wimuks`; `#3036` and `#3068` by `Goodhill1`) inspected only `F_0` (either on the `224`-column data slice or at individual rounding fault sites `24,438`, `3,887`, and `4,060`), leaving the **`B` producer** (`27,019` events, `73`-bit Horner bound), the **backward adjoint sensitivities of all `480` restored helpers**, the **common dyadic grid invariant**, and the **physical recursive bill under `ceiling.ceiling(...)`** unquantified. + +This standalone Mode B research package (`verify.py`, stdlib-only, `< 9s` runtime, no checker extensions, unchanged exact auditor) closes that gap with four verified (author-checked) pillars and six negative controls: + +1. **Pillar 1 — Exact 712-Column Algebraic Replay & 37-Bit / 52-Bit Dynamic Range Collapse:** Replaying all `712` register columns (`224` data `L[0..223]`, `480` dirty helpers `L[224..703]`, `8` private scratch `C[0..7]` mapped to `704..711`) across all `37` native cases (`F_0` with `26099` events, `F_1..F_8` with `26387` events, and `B_1_2..B_7_8` with `27019` events) proves that massive algebraic cancellation across the `B + restore + cleanup` schedule collapses the true interior $\ell_1$ dynamic range by **37 bits in `F`** (`55 -> 18` bits, exact peak $\ell_1 = 131072 = 2^{17}$) and by **52 bits in `B`** (`73 -> 21` bits, exact peak $\ell_1 = 1154896 < 2^{20.14}$, decomposed into peak data $\ell_1 = 200770$, peak helper $\ell_1 = 954130$, and peak private $\ell_1 = 30$). +2. **Pillar 2 — Exact Backward Adjoint Error-Propagation Ledger (`F` and `B`, `704` Outputs) & Wrapper-Helper Isolation:** Using exact transpose-duality (`704` terminal outputs $\times$ `712` input columns verified bit-for-bit between forward and backward passes), we compute the exact worst-case backward $\ell_1$ error-amplification gains from every `climb`/`native_line` child (`3494` in `F`, `3510` in `B`), `add` gate (`20278` in `F`, `20654` in `B`), and `scale` gate (`715` in `F` and `B`) into both the `224` data outputs and the `480` restored helpers, and prove **Wrapper-Helper Adjoint Isolation**: all wrapper `native_line` children (`8` in `F`, `24` in `B`) and wrapper scalar gates have **exact `0` sensitivity** on all `480` restored helpers (`helpers_wrapper_child_gain = 0`, `helpers_wrapper_gate_gain = 0`). +3. **Pillar 3 — Exact Common Dyadic Grid Invariant (`1/16` in `F`, `1/131072` in `B`) & `50 + \beta`-Bit Precision Floor:** Every intermediate rational coefficient across all `712` columns of `F` and `B` has a power-of-two denominator bounded by `16` ($2^4$, `4` fractional bits) in `F` and `131072` ($2^{17}$, `17` fractional bits) in `B`, with maximum numerator magnitude `65537` ($2^{16}+1$). Executing `F` on the common dyadic grid $2^{-4}$ and `B` on $2^{-17}$ makes all `21025` (`F`) and `21401` (`B`) scalar gates **100% exact integer operations (`eps_gate = 0`, `non_integer_grid_steps = 0`)**. This completely eliminates the cancellation rounding faults reported in `#2995`/`#3017` (at `F_0` event `24438`) and `#3036`/`#3068` (at `F_0` events `3887` and `4060`) and reduces the sufficient fixed-point register width for `#2965` target accuracy $H\cdot 2^{-\beta}$ to **`50 + \beta` bits** (`21` signed integer + `29 + \beta` fractional bits), compared to **`75 + \beta` bits** under rounded-gate execution and **`127 + \beta` bits** under the `73`-bit Horner bound (**saving `52` bits** in `B` and **`37` bits** in `F`). +4. **Pillar 4 — Physical Recursive Bill & Packing-Independent `ceiling.ceiling(...)` Screen:** Screening the combined physical recursive bill of `CONSERVED-QQ16` (`F_0 + B_1_2`) plus the `#2707` decoder (`336` rank-1 lines across the 2-call pair, `168` per call) through `research/complex-local-word-ceiling/ceiling.py` demonstrates that under the unchanged hosted nine-stage coverage law (`centre = 64`), the combined profile `{1: 2596, 2: 418, 3: 432, 4: 142, 5: 82, 8: 8}` has exact packing-independent ceiling `a_cap = 0.001633824631` and `kappa_cap = 0.001631159602` (dropping to `a_cap = 0.001512422742`, `kappa_cap = 0.001510138774` when `224` rank-9 $H_9$ endpoint adapters—`112` per call—are paid to exit `F17`). Both lie strictly below the selected baseline $\kappa = 0.001672660197076918$. Only under a hypothetical coverage law that eliminates the `64`-per-call centre tax (`centre = 0`) with an `F17`-native consumer does the surrogate margin reach `a_cap = 0.004579628060`, `kappa_cap = 0.004558750677`. + +--- + +## 2. Pillar 1: Exact 712-Column Algebraic Replay & Interior Dynamic Range Collapse + +Each native invocation in `research/joint-query/certificate.json.gz` operates on `712` register columns: +- **`224` data registers (`L[0..223]`):** `112` `X` ports (`L[0..111]`) and `112` `Y` ports (`L[112..223]`). +- **`480` dirty helper registers (`L[224..703]`):** borrowed at non-zero initial states, actively mixed with data wires across `2950` of `3494` children in `F` and `2928` of `3510` children in `B`, and restored to exact identity (`rows[i] == {i: 1}`) at termination. +- **`8` private scratch registers (`C[0..7]`, indexed `704..711`):** initialized by `clear` before use in `private_sweep`, used to host the `8` wrapper `native_line` children (`inverse_0`..`inverse_7`), and zeroed by `clear` (`rows[i] == {}`) at termination. + +| Metric | `F_0` (`s = 0`) | `F_1..F_8` (`s = 1..8`) | `B_1_2..B_7_8` (`28` pairs) | +| :--- | :---: | :---: | :---: | +| Total expanded events | `26099` | `26387` | `27019` | +| Scalar gates (`add` / `scale` / `clear`) | `21025` (`20278` / `715` / `32`) | `21025` (`20278` / `715` / `32`) | `21401` (`20654` / `715` / `32`) | +| Native children (`climb` core + `native_line` wrapper) | `3494` (`3486` + `8`) | `3494` (`3486` + `8`) | `3510` (`3486` + `24`) | +| Children reading dirty helper entries (`h_l1 > 0`) | `2950` | `2950` | `2928` | +| Formal path-sum Horner bound (`CONSERVED-QQ16.json`) | `5413950274051752469/256` | `5413950274051752469/256` | `573411134169296526275133/64` | +| Formal Horner ceiling width (bits) | `55` | `55` | `73` | +| Exact interior peak data $\ell_1$ norm (`event`, `reg`) | `131072` (`24611`, `93`) | `131072` (`24611`, `93`) | `200770` (`26594`, `93`) | +| Exact interior peak helper $\ell_1$ norm (`event`, `reg`) | `273` (`19243`, `238`) | `273` (`19243`, `238`) | `954130` (`26599`, `93`) | +| Exact interior peak private $\ell_1$ norm (`event`, `reg`) | `68` (`8162`, `704`) | `68` (`8162`, `704`) | `30` (`9985`, `704`) | +| **Exact interior peak total $\ell_1$ norm (`event`, `reg`)** | **`131072` (`24611`, `93`)** | **`131072` (`24611`, `93`)** | **`1154896` (`26594`, `93`)** | +| **Exact algebraic ceiling width (bits)** | **`18`** | **`18`** | **`21`** | +| **Interior dynamic range collapse (bits saved)** | **`37` (`55 -> 18`)** | **`37` (`55 -> 18`)** | **`52` (`73 -> 21`)** | +| Max dyadic denominator ($2^k$) / fractional bits | `16` (`4` bits) | `16` (`4` bits) | `131072` (`17` bits) | +| Max numerator absolute value | `65537` | `65537` | `65537` | +| Peak child-entry $\ell_1$ norm (`total` = `data` / `helper` max) | `124` (`56` / `68`) | `124` (`56` / `68`) | `166` (`158` / `18`) | +| Terminal max data $\ell_1$ norm / helper leak on data | `27` / `0` | `27` / `0` | `64` / `0` | +| Terminal restored helpers / zeroed private `C` registers | `480` / `8` | `480` / `8` | `480` / `8` | + +--- + +## 3. Pillar 2: Exact Backward Adjoint Error-Propagation Ledger & Wrapper-Helper Isolation + +If scalar gate $t$ injects an additive defect $\eta_t$ on register $a_t$ and native child $c$ injects a defect $\zeta_c$ on wire $w_c$, the terminal defect on output register $r \in \{0,\dots,703\}$ is given by the backward adjoint functional $e_r^\top M_{\text{after}}$: +$$|\delta_{\text{out}}(r)| \le G_{\text{child}}(r)\,\varepsilon_{\text{child}} + G_{\text{add}}(r)\,\varepsilon_{\text{add}} + G_{\text{scale}}(r)\,\varepsilon_{\text{scale}}.$$ + +| Output Sector | Producer Side | Total Child Gain $G_{\text{child}}$ | Wrapper Child Gain | Core Child Gain | Max Single-Child Gain | `add` Gate Gain $G_{\text{add}}$ | `scale` Gate Gain $G_{\text{scale}}$ | Combined Scalar Gate Gain $G_{\text{gate}}$ | +| :--- | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | +| Data `X` (`0..111`) | `F` | `132` | `1` | `132` | `2` | `174091/512` | `66311/4` | `2216769809/131072` (`16912.6115`) | +| Data `Y` (`112..223`) | `F` | `118` | `1` | `118` | `2` | `528` | `16392` | `536179/32` (`16755.59375`) | +| **All Data (`0..223`)** | **`F`** | **`132`** | **`1`** | **`132`** | **`2`** | **`528`** | **`66311/4`** | **`2216769809/131072` (`16912.6115`)** | +| **Restored Helpers (`224..703`)** | **`F`** | **`59`** | **`0`** | **`59`** | — | **`5920689/32768`** | **`131163/4`** | **`131599/4` (`32899.75`)** | +| Data `X` (`0..111`) | `B` | `381/2` (`190.5`) | `13` | `381/2` | `12` | `1836679/2` | `16603/4` | `3689923/4` (`922480.75`) | +| Data `Y` (`112..223`) | `B` | `16` | `1` | `16` | `2` | `257` | `5/2` | `258` | +| **All Data (`0..223`)** | **`B`** | **`381/2` (`190.5`)** | **`13`** | **`381/2`** | **`12`** | **`1836679/2`** | **`16603/4`** | **`3689923/4` (`922480.75`)** | +| **Restored Helpers (`224..703`)** | **`B`** | **`393/2` (`196.5`)** | **`0`** | **`393/2`** | — | **`11715/8`** | **`61`** | **`1515` (`1515.0`)** | + +**Wrapper-Helper Adjoint Isolation Theorem:** Across both `F` and `B`, `wrapper_writes_to_helpers = 0` and `wrapper_reads_from_helpers = 0`. Consequently, the `8` wrapper `native_line` children in `F`, the `24` wrapper `native_line` children in `B`, and all wrapper scalar gates have **exact zero** backward adjoint sensitivity to all `480` restored helper outputs (`helpers_wrapper_child_gain = 0`, `helpers_wrapper_gate_gain = 0`). + +--- + +## 4. Pillar 3: Common Dyadic Grid Exactness & Coupling to `#2965` + +Every scalar coefficient in `F` and `B` is dyadic ($c \in \{ \pm 1, \pm 1/2, \pm 1/4, \pm 3/4, \pm 5/4, \pm 9/4, \pm 2, \pm 3, \pm 4, \pm 8 \}$), and every intermediate rational entry across all `712` columns has denominator dividing `16` ($2^4$) in `F` and `131072` ($2^{17}$) in `B`. +- **Common-Grid Exactness (`eps_gate = 0`):** Representing registers on the fixed-point grid $2^{-4}$ in `F` (`4` fractional guard bits) and $2^{-17}$ in `B` (`17` fractional guard bits) makes all `21025` scalar gates in `F` and all `21401` scalar gates in `B` **exact integer operations (`non_integer_grid_steps = 0`)**. +- **Resolution of `#2995`/`#3017`/`#3036`/`#3068` Rounding Faults:** The cancellation faults reported in `#2995`/`#3017` (at `F_0` event `24438`) and `#3036`/`#3068` (at `F_0` events `3887` and `4060`) are artifacts of truncating `scale`/`add` outputs above the `4`-bit (`F`) and `17`-bit (`B`) dyadic grid floor. On the exact dyadic grid, those instructions execute with zero rounding error (`fault_site_checks = true`). +- **Coupling to `#2965` (`qq16-producer-defect-transfer`):** Under `#2965` ($\|F_0^{-1}\|_{\infty\to\infty} = 49$, $\|D\|_{\infty\to\infty} = 1923$, normalized error budget `7587/8192 < 1`), achieving decoded residual accuracy $\|\delta_R\|_\infty \le H\cdot 2^{-\beta}$ suffices whenever $\|\varepsilon_F\|_\infty \le H\cdot 2^{-\beta-8}$ and $\|\varepsilon_B\|_\infty \le H\cdot 2^{-\beta-13}$: + 1. **Exact Common-Grid Scalar Execution (`eps_gate = 0`):** Only child evaluations contribute error (`G_child(F) = 132 < 2^8` with child-entry norm $\le 124 < 2^7$; `G_child(B) = 381/2 < 2^8` with child-entry norm $\le 166 < 2^8$), requiring **`29 + \beta` fractional bits** and **`21` signed integer bits** (since peak interior $\ell_1 = 1154896 < 2^{20.14}$), for a total fixed-point register width of **`50 + \beta` bits**. + 2. **General Rounded-Gate Execution (`eps_gate > 0`):** Total backward amplification is `F_total_adjoint_gain = 2234071313/131072` ($< 2^{15}$) in `F` and `B_total_adjoint_gain = 3690685/4` ($< 2^{20}$) in `B`, requiring `54 + \beta` fractional bits and **`75 + \beta` total bits** in `B`—still **saving `52` bits** compared to the **`127 + \beta` bits** required under the `73`-bit Horner bound (`horner_B_total_bits_offset = 127`). + +--- + +## 5. Pillar 4: Physical Recursive Bill & Packing-Independent `ceiling.ceiling(...)` Screen + +Combining `CONSERVED-QQ16` (`F_0` paid child profile `{1: 2420, 2: 418, 3: 432, 4: 142, 5: 82}`, mass `5530`; `B_1_2` paid child profile `{1: 2436, 2: 418, 3: 432, 4: 142, 5: 82}`, mass `5546`) with the `#2707` decoder (`3823` events, `336` rank-1 lines across the 2-call pair = `168` per call, `2704` scalar adds = `1808` `unit_ADD` + `896` `quarter_ADD`, `312` clears, `464` cover maps) yields a 2-call pair average core+decoder rank-1 count of `2428 + 168 = 2596` per call: + +| Profile Screened (`m = 73`, `families = 896`, `stages = 9`, `grid = 10^-12`) | `centre` / call | Paid Local Mass / call | Certified $a_{\text{cap}}$ (`a_hi`) | Certified $\kappa_{\text{cap}} = a_{\text{cap}}/(1+a_{\text{cap}})$ | Relation to Selected $\kappa = 0.001672660197076918$ | +| :--- | :---: | :---: | :---: | :---: | :---: | +| Selected baseline `{1: 2412, 2: 418, 3: 432, 4: 142, 5: 82, 8: 8}` | `64` | `5586` | `0.001690054110` | `0.001687202646` | Selected ceiling envelope (`+1.45e-5` above selected) | +| `CONSERVED-QQ16` `F` only (uncharged consumer, `centre = 0`) | `0` | `5530` | `0.004730555837` | `0.004708283041` | Uncharged producer-only surrogate margin | +| `CONSERVED-QQ16` `B` only (uncharged consumer, `centre = 0`) | `0` | `5546` | `0.004716424327` | `0.004694284091` | Uncharged producer-only surrogate margin | +| **`CONSERVED-QQ16` pair + `#2707` decoder (`centre = 64` retained)** | **`64`** | **`5770`** | **`0.001633824631`** | **`0.001631159602`** | **Strictly below selected $\kappa$ (`-4.15e-5`)** | +| **`CONSERVED-QQ16` pair + `#2707` decoder + `224` $H_9$ adapters (`centre = 64`)** | **`64`** | **`6778`** | **`0.001512422742`** | **`0.001510138774`** | **Strictly below selected $\kappa$ (`-1.63e-4`)** | +| `CONSERVED-QQ16` pair + `#2707` decoder (`centre = 0`, `F17`-native consumer) | `0` | `5706` | `0.004579628060` | `0.004558750677` | Requires global `centre = 0` coverage law + `F17` consumer | +| `CONSERVED-QQ16` pair + `#2707` decoder + `224` $H_9$ adapters (`centre = 0`) | `0` | `6714` | `0.004239533840` | `0.004221636071` | Requires global `centre = 0` coverage law | + +--- + +## 6. Six Single-Move & Perturbation Negative Controls + +1. **Control 1 (`control_1_horner_vs_exact_algebraic_collapse`):** Confirms the `37`-bit (`55 -> 18` in `F`) and `52`-bit (`73 -> 21` in `B`) collapse between path-sum Horner bounds and exact 712-column algebraic replay (`status = "PASS"`). +2. **Control 2 (`control_2_truncated_restoration_suffix`):** Truncating the restoration/cleanup tail after the last dirty-helper write onto data wires (`event 16850` in `F_1`, `event 18714` in `B_1_2`) leaves **`480` unrestored helpers in `F`** (max helper $\ell_1 = 62$) and **`395` unrestored helpers in `B`** (max helper $\ell_1 = 16$), proving the `B + restore + cleanup` suffix is algebraically mandatory (`status = "REJECTS_TRUNCATED_RESTORATION"`). +3. **Control 3 (`control_3_omitted_private_c_clears`):** Omitting the `32` `clear` gates on `C[0..7]` leaves all **`8` private registers dirty** and corrupts **`112` data outputs in `F`** and **`8` data outputs in `B`** (`status = "REJECTS_OMITTED_PRIVATE_CLEARS"`). +4. **Control 4 (`control_4_synthetic_wrapper_helper_coupling`):** Injecting a single synthetic wrapper read from `A_copy` wire `L[112]` into helper `L[224]` immediately raises `helpers_wrapper_child_gain` from `0` to `1` (`status = "REJECTS_WRAPPER_HELPER_COUPLING"`). +5. **Control 5 (`control_5_single_sign_perturbation_at_peak_helper_event`):** Flipping the sign at the `#3036`/`#3068` helper-cancellation site (`event 3887`) and the peak interior $\ell_1$ site (`event 24611`) in `F_1` leaves **`136` helpers unrestored**, leaks helper dirt onto **`4` data outputs**, and blows up the terminal data $\ell_1$ norm from `27` to **`270668033/4096`** (`status = "REJECTS_SINGLE_SIGN_PERTURBATION"`). +6. **Control 6 (`control_6_uncharged_vs_charged_consumer_ceiling`):** Confirms that under the unchanged `centre = 64` coverage law, paying `#2707`'s `336` rank-1 decoder lines forces $\kappa_{\text{cap}} = 0.001631159602 < 0.001672660197076918$ (`status = "CONFIRMS_CENTRE_AND_CONSUMER_BOTTLENECK"`). + +--- + +## 7. Comparison Against Prior & Open `joint-query-controller` PRs + +| Package / PR | Scope Covered | `B` Replay (`27019` events) | 712-Col (`480` Helpers + `8` `C`) | Backward Adjoint Ledger | Common Grid (`1/16`, `1/131072`) | `ceiling.ceiling(...)` Screen | +| :--- | :--- | :---: | :---: | :---: | :---: | :---: | +| `#2697` (`CONSERVED-QQ16`) | Native producer certificate & Horner bounds (`55` / `73` bits) | Horner only (`73` bits) | Terminal check | No | No | No | +| `#2707` (`qq16-line-normalized-decoder`) | `3823`-event `224`-column `Q_Q16` decoder (`336` rank-1 lines) | N/A | `224`-col decoder | No | No | No | +| `#2965` (`qq16-producer-defect-transfer`) | Terminal transfer $\delta_R = D(F_0^{-1}\varepsilon_F + \varepsilon_B)$ (`49`, `1923`) | Terminal only | `224`-col terminal | No | No | No | +| `#2995` / `#3017` (`Wimuks`) | `F_0` `224`-column data slice & event `24438` rounding fault | No (`F_0` only) | No (`224` data cols) | Partial (`F_0` data) | `F_0` data (`1/16`) | No | +| `#3036` / `#3068` (`Goodhill1`) | `F_0` dirty-helper child count (`2950`) & events `3887`/`4060` | No (`F_0` only) | `F_0` forward only | No | No | No | +| **This Package** | **Full `37`-case `F` & `B` 712-col replay, adjoint ledger, grid & ceiling** | **Yes (`73 -> 21` bits, peak `1154896`)** | **Yes (`712` cols across `37` cases)** | **Yes (`F` & `B`, `704` outputs)** | **Yes (`50 + \beta` bits, `eps_gate = 0`)** | **Yes (`0.001631159602` vs `0.004558750677`)** | + +--- + +## 8. Pinned Upstream Inputs (`SOURCES.json`) + +| Path | Usage | `git_blob` | `sha256` | +| :--- | :---: | :--- | :--- | +| `certificates/selected-result.json` | `provenance` | `b1fea0c94436b236cc2b7d41a7be032811b94c81` | `bb2eaa58647b353f88d0aec2eafb9d30df1be53589231b23e12ceef3e4bad129` | +| `docs/research/agent-task-catalog.json` | `provenance` | `67f085acd86acd7d4e03922d9cf4b26bca66fed5` | `47b42433f5a85809a3aadd29c2c339da2c6ed728e4f7762df6b88bccb7874cf0` | +| `research/complex-local-word-ceiling/RESULT.json` | `input` | `77f55043a679dd722330f1e2499863e36376d9f9` | `d91d6c46509875abf1f61de67c2609656d3dc685451299f83caa6f922493692d` | +| `research/complex-local-word-ceiling/ceiling.py` | `input` | `6c0f54527d879396f689523bfde19928a9b6157c` | `86a1432870b3b21d8454106ec9162fddc0471472d9214c590a1420f2426cedfc` | +| `research/joint-query/certificate.json.gz` | `input` | `c6e876d8b48d768214deee265ade428f8983b566` | `a5ed85fac5ebf3c091482a113ab0d351eb5a7892fe2841a35e16017ec1ff49f7` | +| `research/joint-query/evidence/CONSERVED-QQ16.json` | `input` | `7a155a27dcf7f1ccd48e40d57a2c5d2724016e9b` | `b91eb8599c403db55c889bb225a1cd93f46fdb83eb339f101d18843d52b1c920` | +| `research/qq16-line-normalized-decoder/RESULT.json` | `input` | `ba4167dbf133cff51513bb832802c290edcdffea` | `58df4ad68e2ff335ee58fa4336a449d0f73f3366d840574e5e30b50f507c358d` | +| `research/qq16-producer-defect-transfer/RESULT.json` | `input` | `abe7e44c1d75edaef4c4407aa57a0f94faa949e6` | `d3992b63f7e576a52be846497d37f71a03e89d9481f82d1013743db05dc79cba` | +| `research/qq16-producer-defect-transfer/verify.py` | `input` | `8dd78e9e36acb63451eae88c3c558f7f9afc348a` | `1458d3a188a8ec0124e6edd1fdc7d9238c41d7a547fa2c00229763fc698e46c8` | + +--- + +## 9. Standalone Reproduction + +```bash +python3 -B research/qq16-interior-dynamic-range-and-adjoint-ledger/verify.py +``` + +Expected output (`< 9` seconds, Python 3.12 standard library only): +```text +PASS_QQ16_INTERIOR_DYNAMIC_RANGE_AND_ADJOINT_LEDGER F_collapse_bits 37 B_collapse_bits 52 F_peak_l1 131072 B_peak_l1 1154896 F_child_gain 132 B_child_gain 381/2 centre64_kappa_cap 0.001631159602 no_new_kappa +``` + +--- + +## Open next questions + +1. **Direct $F_{17}$ Consumer Entrance Contract Without $H_9$ Endpoint Adapters:** Can a downstream consumer in the hosted 9-stage template accept the `224` decoded original inputs directly in physical chart $F_{17}$ without paying `224` rank-9 $H_9$ endpoint conversion children (`a_cap = 0.001633824631` vs `0.001512422742` under `centre = 64`, and `a_cap = 0.004579628060`, `kappa_cap = 0.004558750677` under `centre = 0`)? +2. **Exact Dyadic Grid Execution Inside the 3,486 Core Climb Children:** Can the `3,494` (`F`) and `3,510` (`B`) native child interiors execute on the invariant dyadic grids $2^{-4}\mathbb{Z}$ (`F`) and $2^{-17}\mathbb{Z}$ (`B`) with per-child error bounded by $\varepsilon_{\text{child},F} \le H \cdot 2^{-\beta-16}$ and $\varepsilon_{\text{child},B} \le H \cdot 2^{-\beta-21}$ at child-entry $\ell_1$ norms $\le 124$ (`F`) and $\le 166$ (`B`)? + diff --git a/research/qq16-interior-dynamic-range-and-adjoint-ledger/RESULT.json b/research/qq16-interior-dynamic-range-and-adjoint-ledger/RESULT.json new file mode 100644 index 0000000000..f229929a14 --- /dev/null +++ b/research/qq16-interior-dynamic-range-and-adjoint-ledger/RESULT.json @@ -0,0 +1,576 @@ +{ + "negative_controls": { + "control_1_horner_vs_exact_algebraic_collapse": { + "B_collapse_bits": 52, + "B_exact_bits": 21, + "B_horner_bits": 73, + "F_collapse_bits": 37, + "F_exact_bits": 18, + "F_horner_bits": 55, + "status": "PASS" + }, + "control_2_truncated_restoration_suffix": { + "B_cleanup_tail_cut_index": 18714, + "B_max_helper_l1_at_cut": 16, + "B_unrestored_helpers_at_cut": 395, + "F_cleanup_tail_cut_index": 16850, + "F_max_helper_l1_at_cut": 62, + "F_unrestored_helpers_at_cut": 480, + "status": "REJECTS_TRUNCATED_RESTORATION" + }, + "control_3_omitted_private_c_clears": { + "B_data_outputs_corrupted_by_private_inputs": 8, + "B_dirty_private_registers_without_clear": 8, + "F_data_outputs_corrupted_by_private_inputs": 112, + "F_dirty_private_registers_without_clear": 8, + "status": "REJECTS_OMITTED_PRIVATE_CLEARS" + }, + "control_4_synthetic_wrapper_helper_coupling": { + "status": "REJECTS_WRAPPER_HELPER_COUPLING", + "synthetic_wrapper_helper_read_gain": 1, + "unperturbed_wrapper_helper_child_gain": 0 + }, + "control_5_single_sign_perturbation_at_peak_helper_event": { + "data_outputs_with_helper_leak_after_sign_flip": 4, + "perturbed_event_indices": [ + 3887, + 24611 + ], + "status": "REJECTS_SINGLE_SIGN_PERTURBATION", + "terminal_max_data_l1_after_sign_flip": "270668033/4096", + "unperturbed_terminal_max_data_l1": "27", + "unrestored_helpers_after_sign_flip": 136 + }, + "control_6_uncharged_vs_charged_consumer_ceiling": { + "qq16_pair_plus_decoder_centre0_kappa_cap": "0.004558750677", + "qq16_pair_plus_decoder_centre64_kappa_cap": "0.001631159602", + "qq16_pair_plus_decoder_plus_h9_centre64_kappa_cap": "0.001510138774", + "selected_kappa_dec": "0.001672660197076918", + "status": "CONFIRMS_CENTRE_AND_CONSUMER_BOTTLENECK" + } + }, + "pillar1_interior_dynamic_range": { + "B_1_2_to_7_8": { + "adjoint_sensitivities": { + "data_X_add_gain": "1836679/2", + "data_X_child_gain": "381/2", + "data_X_gate_gain": "3689923/4", + "data_X_scale_gain": "16603/4", + "data_Y_add_gain": "257", + "data_Y_child_gain": "16", + "data_Y_gate_gain": "258", + "data_Y_scale_gain": "5/2", + "data_all_add_gain": "1836679/2", + "data_all_child_gain": "381/2", + "data_all_core_child_gain": "381/2", + "data_all_gate_gain": "3689923/4", + "data_all_gate_gain_float": 922480.75, + "data_all_scale_gain": "16603/4", + "data_all_wrapper_child_gain": "13", + "helpers_add_gain": "11715/8", + "helpers_core_child_gain": "393/2", + "helpers_gate_gain": "1515", + "helpers_gate_gain_float": 1515.0, + "helpers_scale_gain": "61", + "helpers_wrapper_child_gain": "0", + "helpers_wrapper_gate_gain": "0", + "max_single_child_to_data": "12" + }, + "algebraic_ceiling_bits": 21, + "case": "B_1_2", + "climb_data_children": 1080, + "climb_helper_children": 2406, + "dirty_children": 2928, + "dynamic_range_collapse_bits": 52, + "event_kinds": { + "adapter": 1090, + "climb": 3486, + "cover_map": 528, + "native_line": 24, + "phase": 10, + "residual_adapter": 480, + "scalar": 21401 + }, + "fault_site_checks": {}, + "horner_ceiling_bits": 73, + "horner_path_sum_bound": "573411134169296526275133/64", + "max_dyadic_denominator": 131072, + "max_dyadic_fractional_bits": 17, + "max_numerator_abs": 65537, + "non_integer_grid_steps": 0, + "peak_child_entry_data_l1": 158, + "peak_child_entry_helper_l1": 18, + "peak_child_entry_total_l1": 166, + "peak_interior_data_event": 26594, + "peak_interior_data_l1": 200770, + "peak_interior_data_register": 93, + "peak_interior_helper_event": 26599, + "peak_interior_helper_l1": 954130, + "peak_interior_helper_register": 93, + "peak_interior_private_event": 9985, + "peak_interior_private_l1": 30, + "peak_interior_private_register": 704, + "peak_interior_total_event": 26594, + "peak_interior_total_l1": 1154896, + "peak_interior_total_register": 93, + "scalar_gates": 21401, + "scalar_op_counts": { + "add": 20654, + "clear": 32, + "scale": 715 + }, + "side": "B", + "terminal_data_l1": 64, + "terminal_helper_leak_on_data": 0, + "terminal_restored_helpers": 480, + "terminal_zero_private_registers": 8, + "total_children": 3510, + "total_events": 27019, + "wrapper_helper_isolation": { + "transpose_duality_704_rows_verified": true, + "wrapper_child_to_helper_gain": 0, + "wrapper_gate_to_helper_gain": 0, + "wrapper_reads_from_helpers": 0, + "wrapper_writes_to_helpers": 0 + }, + "wrapper_line_data_children": 16, + "wrapper_line_private_children": 8 + }, + "F_0": { + "adjoint_sensitivities": { + "data_X_add_gain": "174091/512", + "data_X_child_gain": "132", + "data_X_gate_gain": "2216769809/131072", + "data_X_scale_gain": "66311/4", + "data_Y_add_gain": "528", + "data_Y_child_gain": "118", + "data_Y_gate_gain": "536179/32", + "data_Y_scale_gain": "16392", + "data_all_add_gain": "528", + "data_all_child_gain": "132", + "data_all_core_child_gain": "132", + "data_all_gate_gain": "2216769809/131072", + "data_all_gate_gain_float": 16912.6115, + "data_all_scale_gain": "66311/4", + "data_all_wrapper_child_gain": "1", + "helpers_add_gain": "5920689/32768", + "helpers_core_child_gain": "59", + "helpers_gate_gain": "131599/4", + "helpers_gate_gain_float": 32899.75, + "helpers_scale_gain": "131163/4", + "helpers_wrapper_child_gain": "0", + "helpers_wrapper_gate_gain": "0", + "max_single_child_to_data": "2" + }, + "algebraic_ceiling_bits": 18, + "case": "F_0", + "climb_data_children": 1080, + "climb_helper_children": 2406, + "dirty_children": 2950, + "dynamic_range_collapse_bits": 37, + "event_kinds": { + "adapter": 1090, + "climb": 3486, + "native_line": 8, + "phase": 10, + "residual_adapter": 480, + "scalar": 21025 + }, + "fault_site_checks": { + "event_24438_op": true, + "event_3887_op": true, + "event_4060_op": true + }, + "horner_ceiling_bits": 55, + "horner_path_sum_bound": "5413950274051752469/256", + "max_dyadic_denominator": 16, + "max_dyadic_fractional_bits": 4, + "max_numerator_abs": 65537, + "non_integer_grid_steps": 0, + "peak_child_entry_data_l1": 56, + "peak_child_entry_helper_l1": 68, + "peak_child_entry_total_l1": 124, + "peak_interior_data_event": 24611, + "peak_interior_data_l1": 131072, + "peak_interior_data_register": 93, + "peak_interior_helper_event": 19243, + "peak_interior_helper_l1": 273, + "peak_interior_helper_register": 238, + "peak_interior_private_event": 8162, + "peak_interior_private_l1": 68, + "peak_interior_private_register": 704, + "peak_interior_total_event": 24611, + "peak_interior_total_l1": 131072, + "peak_interior_total_register": 93, + "scalar_gates": 21025, + "scalar_op_counts": { + "add": 20278, + "clear": 32, + "scale": 715 + }, + "side": "F", + "terminal_data_l1": 27, + "terminal_helper_leak_on_data": 0, + "terminal_restored_helpers": 480, + "terminal_zero_private_registers": 8, + "total_children": 3494, + "total_events": 26099, + "wrapper_helper_isolation": { + "transpose_duality_704_rows_verified": true, + "wrapper_child_to_helper_gain": 0, + "wrapper_gate_to_helper_gain": 0, + "wrapper_reads_from_helpers": 0, + "wrapper_writes_to_helpers": 0 + }, + "wrapper_line_data_children": 0, + "wrapper_line_private_children": 8 + }, + "F_1_to_8": { + "adjoint_sensitivities": { + "data_X_add_gain": "174091/512", + "data_X_child_gain": "132", + "data_X_gate_gain": "2216769809/131072", + "data_X_scale_gain": "66311/4", + "data_Y_add_gain": "528", + "data_Y_child_gain": "118", + "data_Y_gate_gain": "536179/32", + "data_Y_scale_gain": "16392", + "data_all_add_gain": "528", + "data_all_child_gain": "132", + "data_all_core_child_gain": "132", + "data_all_gate_gain": "2216769809/131072", + "data_all_gate_gain_float": 16912.6115, + "data_all_scale_gain": "66311/4", + "data_all_wrapper_child_gain": "1", + "helpers_add_gain": "5920689/32768", + "helpers_core_child_gain": "59", + "helpers_gate_gain": "131599/4", + "helpers_gate_gain_float": 32899.75, + "helpers_scale_gain": "131163/4", + "helpers_wrapper_child_gain": "0", + "helpers_wrapper_gate_gain": "0", + "max_single_child_to_data": "2" + }, + "algebraic_ceiling_bits": 18, + "case": "F_1", + "climb_data_children": 1080, + "climb_helper_children": 2406, + "dirty_children": 2950, + "dynamic_range_collapse_bits": 37, + "event_kinds": { + "adapter": 1090, + "climb": 3486, + "cover_map": 288, + "native_line": 8, + "phase": 10, + "residual_adapter": 480, + "scalar": 21025 + }, + "fault_site_checks": { + "event_24438_op": true, + "event_3887_op": true, + "event_4060_op": true + }, + "horner_ceiling_bits": 55, + "horner_path_sum_bound": "5413950274051752469/256", + "max_dyadic_denominator": 16, + "max_dyadic_fractional_bits": 4, + "max_numerator_abs": 65537, + "non_integer_grid_steps": 0, + "peak_child_entry_data_l1": 56, + "peak_child_entry_helper_l1": 68, + "peak_child_entry_total_l1": 124, + "peak_interior_data_event": 24611, + "peak_interior_data_l1": 131072, + "peak_interior_data_register": 93, + "peak_interior_helper_event": 19243, + "peak_interior_helper_l1": 273, + "peak_interior_helper_register": 238, + "peak_interior_private_event": 8162, + "peak_interior_private_l1": 68, + "peak_interior_private_register": 704, + "peak_interior_total_event": 24611, + "peak_interior_total_l1": 131072, + "peak_interior_total_register": 93, + "scalar_gates": 21025, + "scalar_op_counts": { + "add": 20278, + "clear": 32, + "scale": 715 + }, + "side": "F", + "terminal_data_l1": 27, + "terminal_helper_leak_on_data": 0, + "terminal_restored_helpers": 480, + "terminal_zero_private_registers": 8, + "total_children": 3494, + "total_events": 26387, + "wrapper_helper_isolation": { + "transpose_duality_704_rows_verified": true, + "wrapper_child_to_helper_gain": 0, + "wrapper_gate_to_helper_gain": 0, + "wrapper_reads_from_helpers": 0, + "wrapper_writes_to_helpers": 0 + }, + "wrapper_line_data_children": 0, + "wrapper_line_private_children": 8 + }, + "verified_cases_count": 37 + }, + "pillar2_backward_adjoint_ledger": { + "B": { + "data_X_add_gain": "1836679/2", + "data_X_child_gain": "381/2", + "data_X_gate_gain": "3689923/4", + "data_X_scale_gain": "16603/4", + "data_Y_add_gain": "257", + "data_Y_child_gain": "16", + "data_Y_gate_gain": "258", + "data_Y_scale_gain": "5/2", + "data_all_add_gain": "1836679/2", + "data_all_child_gain": "381/2", + "data_all_core_child_gain": "381/2", + "data_all_gate_gain": "3689923/4", + "data_all_gate_gain_float": 922480.75, + "data_all_scale_gain": "16603/4", + "data_all_wrapper_child_gain": "13", + "helpers_add_gain": "11715/8", + "helpers_core_child_gain": "393/2", + "helpers_gate_gain": "1515", + "helpers_gate_gain_float": 1515.0, + "helpers_scale_gain": "61", + "helpers_wrapper_child_gain": "0", + "helpers_wrapper_gate_gain": "0", + "max_single_child_to_data": "12" + }, + "F": { + "data_X_add_gain": "174091/512", + "data_X_child_gain": "132", + "data_X_gate_gain": "2216769809/131072", + "data_X_scale_gain": "66311/4", + "data_Y_add_gain": "528", + "data_Y_child_gain": "118", + "data_Y_gate_gain": "536179/32", + "data_Y_scale_gain": "16392", + "data_all_add_gain": "528", + "data_all_child_gain": "132", + "data_all_core_child_gain": "132", + "data_all_gate_gain": "2216769809/131072", + "data_all_gate_gain_float": 16912.6115, + "data_all_scale_gain": "66311/4", + "data_all_wrapper_child_gain": "1", + "helpers_add_gain": "5920689/32768", + "helpers_core_child_gain": "59", + "helpers_gate_gain": "131599/4", + "helpers_gate_gain_float": 32899.75, + "helpers_scale_gain": "131163/4", + "helpers_wrapper_child_gain": "0", + "helpers_wrapper_gate_gain": "0", + "max_single_child_to_data": "2" + } + }, + "pillar3_dyadic_grid_and_precision_floor": { + "B_dyadic_grid_fractional_bits": 17, + "B_scalar_gates_exact_on_grid": 21401, + "B_total_adjoint_gain": "3690685/4", + "B_total_adjoint_gain_bits": 20, + "F_dyadic_grid_fractional_bits": 4, + "F_scalar_gates_exact_on_grid": 21025, + "F_total_adjoint_gain": "2234071313/131072", + "F_total_adjoint_gain_bits": 15, + "common_grid_child_fractional_bits_offset": 29, + "common_grid_total_fixed_point_bits_offset": 50, + "dynamic_range_bits_saved_in_B": 52, + "dynamic_range_bits_saved_in_F": 37, + "horner_bound_B_total_bits_offset": 127, + "pr2965_F0_inverse_l1_norm": 49, + "pr2965_decoder_D_l1_norm": 1923, + "pr2965_normalized_error_budget": "7587/8192", + "rounded_gate_B_fractional_bits_offset": 54, + "rounded_gate_B_total_bits_offset": 75 + }, + "pillar4_physical_recursive_bill_and_ceilings": { + "decoder_pr2707_events": 3823, + "decoder_pr2707_trace": { + "add": 2704, + "begin": 3, + "checkpoint": 1, + "clear": 312, + "end": 3, + "line": 336, + "map": 464, + "quarter_ADD": 896, + "unit_ADD": 1808 + }, + "producer_B_invoice": { + "arbitrary_helpers": 480, + "arbitrary_private_inputs_discarded": 8, + "complete_scalar": { + "macros": 21401, + "operations": { + "add": 20654, + "clear": 32, + "scale": 715 + }, + "real_primitives": 214986 + }, + "existing_owned_C0_fields": 1, + "formal_prefix": { + "formal_prefix_ceiling_log2": 73, + "formal_triangle_Horner_bound": "573411134169296526275133/64" + }, + "native_mass": 5546, + "native_profile": { + "1": 2436, + "2": 418, + "3": 432, + "4": 142, + "5": 82 + }, + "new_fields": 0, + "private_outputs_zero": 8 + }, + "producer_F_invoice": { + "arbitrary_helpers": 480, + "arbitrary_private_inputs_discarded": 8, + "complete_scalar": { + "macros": 21025, + "operations": { + "add": 20278, + "clear": 32, + "scale": 715 + }, + "real_primitives": 211210 + }, + "existing_owned_C0_fields": 1, + "formal_prefix": { + "formal_prefix_ceiling_log2": 55, + "formal_triangle_Horner_bound": "5413950274051752469/256" + }, + "native_mass": 5530, + "native_profile": { + "1": 2420, + "2": 418, + "3": 432, + "4": 142, + "5": 82 + }, + "new_fields": 0, + "private_outputs_zero": 8 + }, + "profiles": { + "qq16_B_only_centre0": { + "a_cap_dec": "0.004716424327", + "a_hi": "4716424327/1000000000000", + "a_lo": "2358212163/500000000000", + "centre_per_call": "0", + "kappa_cap_dec": "0.004694284091", + "local_mass_per_call": "5546" + }, + "qq16_F_only_centre0": { + "a_cap_dec": "0.004730555837", + "a_hi": "4730555837/1000000000000", + "a_lo": "1182638959/250000000000", + "centre_per_call": "0", + "kappa_cap_dec": "0.004708283041", + "local_mass_per_call": "5530" + }, + "qq16_pair_plus_decoder_centre0": { + "a_cap_dec": "0.004579628060", + "a_hi": "228981403/50000000000", + "a_lo": "4579628059/1000000000000", + "centre_per_call": "0", + "kappa_cap_dec": "0.004558750677", + "local_mass_per_call": "5706" + }, + "qq16_pair_plus_decoder_centre64": { + "a_cap_dec": "0.001633824631", + "a_hi": "1633824631/1000000000000", + "a_lo": "163382463/100000000000", + "centre_per_call": "64", + "kappa_cap_dec": "0.001631159602", + "local_mass_per_call": "5770" + }, + "qq16_pair_plus_decoder_plus_h9_centre0": { + "a_cap_dec": "0.004239533840", + "a_hi": "52994173/12500000000", + "a_lo": "4239533839/1000000000000", + "centre_per_call": "0", + "kappa_cap_dec": "0.004221636071", + "local_mass_per_call": "6714" + }, + "qq16_pair_plus_decoder_plus_h9_centre64": { + "a_cap_dec": "0.001512422742", + "a_hi": "756211371/500000000000", + "a_lo": "1512422741/1000000000000", + "centre_per_call": "64", + "kappa_cap_dec": "0.001510138774", + "local_mass_per_call": "6778" + }, + "selected_baseline_centre64": { + "a_cap_dec": "0.001690054110", + "a_hi": "169005411/100000000000", + "a_lo": "1690054109/1000000000000", + "centre_per_call": "64", + "kappa_cap_dec": "0.001687202646", + "local_mass_per_call": "5586" + } + }, + "selected_ceiling_a_cap_dec": "0.001690054110", + "selected_ceiling_kappa_cap_dec": "0.001687202646", + "selected_kappa_dec": "0.001672660197076918" + }, + "schema_version": 1, + "status": "PASS_QQ16_INTERIOR_DYNAMIC_RANGE_AND_ADJOINT_LEDGER", + "summary": { + "B_data_child_gain": "381/2", + "B_data_gate_gain": "3689923/4", + "B_dirty_children": 2928, + "B_dynamic_range_collapse_bits": 52, + "B_events": 27019, + "B_exact_algebraic_bits": 21, + "B_helper_core_child_gain": "393/2", + "B_helper_gate_gain": "1515", + "B_helper_wrapper_child_gain": 0, + "B_horner_bits": 73, + "B_max_dyadic_denominator": 131072, + "B_peak_child_entry_l1": 166, + "B_peak_interior_data_l1": 200770, + "B_peak_interior_helper_l1": 954130, + "B_peak_interior_private_l1": 30, + "B_peak_interior_total_l1": 1154896, + "B_scalar_gates": 21401, + "B_total_children": 3510, + "F0_events": 26099, + "F_data_child_gain": "132", + "F_data_gate_gain": "2216769809/131072", + "F_dirty_children": 2950, + "F_dynamic_range_collapse_bits": 37, + "F_events": 26387, + "F_exact_algebraic_bits": 18, + "F_helper_core_child_gain": "59", + "F_helper_gate_gain": "131599/4", + "F_helper_wrapper_child_gain": 0, + "F_horner_bits": 55, + "F_max_dyadic_denominator": 16, + "F_peak_child_entry_l1": 124, + "F_peak_interior_data_l1": 131072, + "F_peak_interior_helper_l1": 273, + "F_peak_interior_private_l1": 68, + "F_peak_interior_total_l1": 131072, + "F_scalar_gates": 21025, + "F_total_children": 3494, + "common_grid_fixed_point_bits_offset": 50, + "data_columns": 224, + "dirty_helper_columns": 480, + "horner_B_total_bits_offset": 127, + "private_c_columns": 8, + "qq16_pair_plus_decoder_centre0_a_cap": "0.004579628060", + "qq16_pair_plus_decoder_centre0_kappa_cap": "0.004558750677", + "qq16_pair_plus_decoder_centre64_a_cap": "0.001633824631", + "qq16_pair_plus_decoder_centre64_kappa_cap": "0.001631159602", + "qq16_pair_plus_decoder_plus_h9_centre64_kappa_cap": "0.001510138774", + "rounded_gate_B_total_bits_offset": 75, + "total_columns_replayed": 712 + } +} diff --git a/research/qq16-interior-dynamic-range-and-adjoint-ledger/SOURCES.json b/research/qq16-interior-dynamic-range-and-adjoint-ledger/SOURCES.json new file mode 100644 index 0000000000..5728fbcacf --- /dev/null +++ b/research/qq16-interior-dynamic-range-and-adjoint-ledger/SOURCES.json @@ -0,0 +1,60 @@ +{ + "schema_version": 1, + "base_commit": "997e6a9ca7b4f95d50e366f61412fd640d72a88a", + "files": [ + { + "path": "certificates/selected-result.json", + "usage": "provenance", + "git_blob": "b1fea0c94436b236cc2b7d41a7be032811b94c81", + "sha256": "bb2eaa58647b353f88d0aec2eafb9d30df1be53589231b23e12ceef3e4bad129" + }, + { + "path": "docs/research/agent-task-catalog.json", + "usage": "provenance", + "git_blob": "67f085acd86acd7d4e03922d9cf4b26bca66fed5", + "sha256": "47b42433f5a85809a3aadd29c2c339da2c6ed728e4f7762df6b88bccb7874cf0" + }, + { + "path": "research/joint-query/evidence/CONSERVED-QQ16.json", + "usage": "input", + "git_blob": "7a155a27dcf7f1ccd48e40d57a2c5d2724016e9b", + "sha256": "b91eb8599c403db55c889bb225a1cd93f46fdb83eb339f101d18843d52b1c920" + }, + { + "path": "research/joint-query/certificate.json.gz", + "usage": "input", + "git_blob": "c6e876d8b48d768214deee265ade428f8983b566", + "sha256": "a5ed85fac5ebf3c091482a113ab0d351eb5a7892fe2841a35e16017ec1ff49f7" + }, + { + "path": "research/qq16-producer-defect-transfer/RESULT.json", + "usage": "input", + "git_blob": "abe7e44c1d75edaef4c4407aa57a0f94faa949e6", + "sha256": "d3992b63f7e576a52be846497d37f71a03e89d9481f82d1013743db05dc79cba" + }, + { + "path": "research/qq16-producer-defect-transfer/verify.py", + "usage": "input", + "git_blob": "8dd78e9e36acb63451eae88c3c558f7f9afc348a", + "sha256": "1458d3a188a8ec0124e6edd1fdc7d9238c41d7a547fa2c00229763fc698e46c8" + }, + { + "path": "research/qq16-line-normalized-decoder/RESULT.json", + "usage": "input", + "git_blob": "ba4167dbf133cff51513bb832802c290edcdffea", + "sha256": "58df4ad68e2ff335ee58fa4336a449d0f73f3366d840574e5e30b50f507c358d" + }, + { + "path": "research/complex-local-word-ceiling/RESULT.json", + "usage": "input", + "git_blob": "77f55043a679dd722330f1e2499863e36376d9f9", + "sha256": "d91d6c46509875abf1f61de67c2609656d3dc685451299f83caa6f922493692d" + }, + { + "path": "research/complex-local-word-ceiling/ceiling.py", + "usage": "input", + "git_blob": "6c0f54527d879396f689523bfde19928a9b6157c", + "sha256": "86a1432870b3b21d8454106ec9162fddc0471472d9214c590a1420f2426cedfc" + } + ] +} diff --git a/research/qq16-interior-dynamic-range-and-adjoint-ledger/TASK.json b/research/qq16-interior-dynamic-range-and-adjoint-ledger/TASK.json new file mode 100644 index 0000000000..2ac2e608fb --- /dev/null +++ b/research/qq16-interior-dynamic-range-and-adjoint-ledger/TASK.json @@ -0,0 +1,118 @@ +{ + "schema_version": 1, + "task_id": "joint-query-controller", + "track_id": "recursive-interfaces", + "priority_revision": 6, + "base_commit": "997e6a9ca7b4f95d50e366f61412fd640d72a88a", + "chooser_seed": "d78c20261017jq000000000000000001", + "original_card": { + "id": "joint-query-controller", + "question": "Can a literal QQ16 producer meet the proposed completed-output error budgets with dirty helpers and an affordable physical consumer?", + "starting_points": [ + "docs/research/research-family-status.md", + "research/joint-query/README.md", + "research/joint-query/evidence/QQ16-SELECTED-WITNESS.md", + "research/joint-query/evidence/JOINT-QUERY-TRANSFER.md", + "docs/research/community-efficient1000-review.md", + "research/qq16-producer-defect-transfer/README.md" + ], + "methods": [ + "Derive one literal producer's completed-output defects and intermediate dirty-helper bounds, with its physical bill.", + "Design or audit one consumer, retention or hosting boundary and its complete cost for the pinned producer/decoder." + ], + "acceptance_gate": "Name the changed premise of the fixed F0/B1 observation obstruction. Show exactly which query is recovered, legal native reads and restoration, and a full favorable budget including cover maps, helpers and endpoints. Local inverse identities alone do not close the global controller. 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", + "scripts/research_baseline.py" + ], + "expected": "PASS_RESEARCH_BASELINE_BINDINGS_ONLY", + "inspect": "Read the revision-6 family record and #2965 producer-defect transfer after the local QQ16 decoder contract. Its author-checked output-error estimate does not implement producer interiors, bound dirty helpers, or pay for the consumer; independently check the implication used.", + "scope": "Source-bound orientation only. Read the named package and review before relying on its local evidence; this command is not its replay or supplier admission." + }, + "first_experiment": "Pin one literal F0/B1 producer and its native-child contracts; derive the actual intermediate magnitude ledger and completed-output defects, including dirty helpers and correlations. Compare with #2965 budgets and price storage, movement, cleanup and F17 consumption. Stop with a precise missing bound if no producer contract supplies it; do not optimize another decoder precision constant in isolation.", + "bottleneck_link": "The native local words exist; retained query information and its physical access are the missing link to a composed recursive interface.", + "allowed_variations": [ + "One paid query, one changed first pair, or one precisely specified affine helper state.", + "A counterexample or lower bound for that exact proposed repair.", + "One unresolved obligation of a newer local decoder, with exact source heads and a distinct claim/domain." + ], + "scope_change_triggers": [ + "Retaining the fixed first pair and ordinary schedule while allowing only homogeneous selected-only control, already excluded by the witness.", + "Treating cover-map counts as zero-cost physical address operations.", + "Recreating the pending complete local decoder or early-record/output-bank coalescing already under investigation without a distinct audit or changed premise.", + "Treating a completed-output defect inequality as a producer-interior, dirty-range or physical-cost certificate." + ], + "overlap_terms": [ + "QQ16", + "joint-query", + "changing-chart controller", + "selected observation", + "1969", + "2540", + "early record", + "output-bank retention", + "complete native decoder", + "2965", + "producer defect", + "dirty-helper range", + "F17 consumer" + ] + }, + "scope_status": "unchanged", + "actual_scope": "Can a literal QQ16 producer meet the proposed completed-output error budgets with dirty helpers and an affordable physical consumer?", + "bottleneck_link": "Closes the interior producer dynamic-range, dirty-helper restoration, and backward adjoint error-propagation obligations left open by PR #2965 (qq16-producer-defect-transfer, merged_for_archive_only / partially_reviewed), establishing (report, author-checked) a 37-bit (F) and 52-bit (B) interior dynamic-range collapse (from 55/73 Horner bits to 18/21 exact algebraic bits), exact dyadic grid denominators (16 in F, 131,072 in B), exact backward adjoint child and scalar-gate sensitivities on both completed data outputs and all 480 restored helpers, and the exact ceiling.ceiling(...) consumer bill.", + "stop_rule": "Stop after replaying all 26,387 events of F (26,099 in F_0) and 27,019 events of B across all 712 columns (224 data + 480 dirty helpers + 8 private C0..C7), establishing (report, author-checked) the 37-bit/52-bit interior dynamic range collapse and 4-bit/17-bit exact dyadic grid invariance, deriving the exact backward adjoint sensitivities (132, 381/2, 59, 393/2 for children; 2216769809/131072, 3689923/4, 131599/4, 1515 for scalar gates; 0 for wrapper-to-helper sensitivity), coupling with #2965/#2707, and screening the physical F17 consumer bill with ceiling.ceiling(...) across 6 negative controls.", + "outcome": "completed", + "evidence": "research/qq16-interior-dynamic-range-and-adjoint-ledger/verify.py and research/qq16-interior-dynamic-range-and-adjoint-ledger/RESULT.json", + "predecessors": { + "845": "Selected complex supplier core lineage", + "1012": "Coverage identity mass = 72 W + 64 N", + "1094": "Validated selected conditional record (kappa = 0.001672660197076918)", + "1098": "Selected replay audit and local program archive", + "1240": "Packing-independent complex local-word ceiling solver", + "1659": "Centre-encoding sparse replay lineage", + "1708": "Forward fanout centre-phase lineage", + "1712": "Native recipe and Clifford frame audit lineage", + "1748": "Reverse centre-phase shared-return guard", + "1791": "Local helper and frame access invariants", + "1829": "Selected centre native lift lineage", + "1918": "Clifford route-involution extraction", + "1969": "Reviewed CONSERVED-QQ16 local producer words and joint-query certificate (merged_for_archive_only / partially_reviewed)", + "2048": "Forward/backward scalar quarter centre identity", + "2199": "Exact DATA-PHASES Clifford recipe audit", + "2391": "Native centre-reuse and cover-owner repair formulation", + "2540": "Retained-record native QQ16 decoder (merged_for_archive_only / partially_reviewed)", + "2678": "Rank-9 H9 endpoint frame conversion tariff (merged_for_archive_only / partially_reviewed)", + "2681": "Ordered inverse equations for the zero-retention QQ16 decoder (merged_for_archive_only / partially_reviewed)", + "2697": "QQ16 cut-retention and transcript capacity lineage (merged_for_archive_only / partially_reviewed)", + "2707": "Physical 3,823-event line-normalized zero-retention F17 decoder (merged_for_archive_only / partially_reviewed)", + "2736": "Completed-defect stability theorem for the zero-retention decoder (merged_for_archive_only / partially_reviewed)", + "2771": "Direct rounded native-line pair arithmetic", + "2807": "Finite dyadic format for the zero-retention decoder", + "2811": "Rounded pair bit-circuit counts", + "2873": "QQ16 entry-frame and caller-grid reserve lineage", + "2876": "Common block-scale scan circuit", + "2932": "QQ16 borrowed-reuse and scratch-travel audit lineage (merged_for_archive_only / partially_reviewed)", + "2959": "Exact-producer entry contract (B <= 17,628 H, Q0 = f + 9*lambda + ceil(lambda/2) + 6, merged_for_archive_only / partially_reviewed)", + "2965": "Completed-output producer defect transfer (49 eps_F + 1923 eps_B + eps_D, merged_for_archive_only / partially_reviewed)" + }, + "open_questions": [ + { + "question": "Can a downstream consumer in the hosted 9-stage template accept the 224 decoded original inputs directly in physical chart F17 without paying 224 rank-9 H9 endpoint conversion children?", + "why_it_matters": "Under the unchanged global coverage law (centre = 64), adding the 8 (F) + 24 (B) wrapper lines and 336 rank-1 decoder lines (#2707) lowers the two-call ceiling from a_cap = 0.001690054110 to 0.001633824631 (and to 0.001512422742 if 224 rank-9 H9 adapters are also charged), whereas under a global centre-free coverage law (centre = 0) an F17-native consumer achieves a_cap = 0.004579628060 (kappa_cap = 0.004558750677).", + "first_step": "Specify the downstream stage-2/stage-3 consumer entrance frames and test whether the 17 coordinate-line factors of F17 can be absorbed into the next stage's entry adapters.", + "blocked_by": "The current hosted template requires canonical entrance frames (C_q on X, I on Y) at every local call boundary, so consuming F17 directly requires a changed inter-call frame contract." + }, + { + "question": "Can the 3,494 (F) and 3,510 (B) native child interiors execute on the exact invariant dyadic grids 2^-4 Z (F) and 2^-17 Z (B) with per-child error bounded by eps_child,F <= H * 2^(-beta-16) and eps_child,B <= H * 2^(-beta-21)?", + "why_it_matters": "Because the maximum interior dyadic denominator across all 712 columns is 16 = 2^4 in F and 131,072 = 2^17 in B, exact fixed-point execution with 4 (F) and 17 (B) fractional guard bits makes all 21,025 (F) and 21,401 (B) scalar gates 100% exact (eps_gate = 0), eliminating the PR #2995/#3017/#3036/#3068 cancellation rounding faults and reducing the #2965 tolerance budget entirely to child-interior accuracy (132 * eps_child,F and 381/2 * eps_child,B).", + "first_step": "Bind the 3,486 retained core climb recipes (ranks 1..5) and 8/24 wrapper native_line recipes to a common component grid at child-entry L1 norms <= 124 (F) and <= 166 (B).", + "blocked_by": "Retained core climb recipes are specified as ideal Gaussian-Clifford kernels; their internal finite-precision rounding recurrence across recursive depth is not yet pinned in the repository." + } + ], + "author": "dcharb78", + "ai_assistance": "Prepared with AI assistance; all outputs deterministically verified by verify.py.", + "license": "Apache-2.0" +} diff --git a/research/qq16-interior-dynamic-range-and-adjoint-ledger/VERIFY.json b/research/qq16-interior-dynamic-range-and-adjoint-ledger/VERIFY.json new file mode 100644 index 0000000000..401d750c0e --- /dev/null +++ b/research/qq16-interior-dynamic-range-and-adjoint-ledger/VERIFY.json @@ -0,0 +1,26 @@ +{ + "schema_version": 1, + "status": "ready", + "python": "3.12", + "requirements": [], + "inputs": [ + "research/joint-query/evidence/CONSERVED-QQ16.json", + "research/joint-query/certificate.json.gz", + "research/qq16-producer-defect-transfer/RESULT.json", + "research/qq16-producer-defect-transfer/verify.py", + "research/qq16-line-normalized-decoder/RESULT.json", + "research/complex-local-word-ceiling/RESULT.json", + "research/complex-local-word-ceiling/ceiling.py" + ], + "commands": [ + { + "argv": [ + "{python}", + "-B", + "{package}/verify.py" + ], + "timeout_seconds": 120, + "checks": "Authenticates all 9 pinned SOURCES.json files; replays all 26,099 events of F_0, 26,387 events of F_1..F_8, and 27,019 events of B_1_2..B_7_8 across all 712 columns (224 data + 480 dirty helpers + 8 private C0..C7) to prove the 37-bit (F: 55->18 bits, peak L1 131,072) and 52-bit (B: 73->21 bits, peak L1 1,154,896) interior dynamic-range collapse and exact dyadic denominators (16 in F, 131,072 in B); executes backward adjoint replay across all 704 terminal outputs to certify exact child/add/scale error sensitivities and 0 wrapper-to-helper sensitivity; couples with #2965/#2707 and screens physical consumer profiles via ceiling.ceiling(...) across 6 behavioral negative controls." + } + ] +} diff --git a/research/qq16-interior-dynamic-range-and-adjoint-ledger/verify.py b/research/qq16-interior-dynamic-range-and-adjoint-ledger/verify.py new file mode 100644 index 0000000000..77af493f59 --- /dev/null +++ b/research/qq16-interior-dynamic-range-and-adjoint-ledger/verify.py @@ -0,0 +1,1020 @@ +#!/usr/bin/env python3 +# SPDX-License-Identifier: Apache-2.0 +"""Exact 712-column interior dynamic range, dyadic grid invariance, backward +adjoint error-propagation ledger, and F17 consumer ceiling screen for CONSERVED-QQ16. + +Computes and verifies four unified pillars (plus six behavioral negative controls) +directly from the nine upstream files pinned in SOURCES.json: + 1. Pillar 1 — Exact 712-Column Algebraic Replay of CONSERVED-QQ16 Programs F + (26,099 events in F_0; 26,387 events in F_1..F_8) and B (27,019 events in + B_1_2..B_7_8) & The 37-Bit (F) / 52-Bit (B) Interior Dynamic Range Collapse: + - Proves that exact helper cancellations collapse interior L1 row norms from + the 55-bit (F) and 73-bit (B) Horner path-sum triangle bounds down to + 131,072 (2^17, 18 bits) in F and 1,154,896 (< 2^20.14, 21 bits) in B, + with peak child-entry L1 norms <= 124 (7 bits) in F and <= 166 (8 bits) in B, + and maximum dyadic denominators 16 (2^4) in F and 131,072 (2^17) in B. + 2. Pillar 2 — Exact Backward Adjoint Error-Propagation Ledger (Closing Open + Question 1 of PR #2965): + - Propagates unit child, add, and scale errors backward through the exact + transpose DAGs of F and B across all 704 terminal outputs (0..223 data, + 224..703 restored helpers), certifying exact worst-case L_inf gains: + * F data (0..223): 132 * eps_child + 2216769809/131072 * eps_gate + (add = 528, scale = 66311/4, single-child max = 2). + * F helpers (224..703): 0 * eps_wrap_child + 59 * eps_core_child + 131599/4 * eps_gate. + * B data (0..223): 381/2 * eps_child + 3689923/4 * eps_gate + (add = 1836679/2, scale = 16603/4, single-child max = 12). + * B helpers (224..703): 0 * eps_wrap_child + 393/2 * eps_core_child + 1515 * eps_gate. + 3. Pillar 3 — Wrapper-Helper Adjoint Orthogonality (0 * eps_wrap_child), Exact + Dyadic Common-Grid Escape from PR #2995/#3017/#3036/#3068 Cancellation Faults, + & End-to-End Precision Floor Coupled with #2965: + - Proves why all wrapper native_line children (8 in F, 24 in B) and wrapper + scalar gates have 0 backward sensitivity to all 480 restored helpers; + proves that 4 (F) and 17 (B) fractional guard bits make all 21,025 (F) and + 21,401 (B) scalar gates 100% exact (eps_gate = 0); and couples with #2965 + (||F0^-1||_inf = 49, ||D||_inf <= 1923, budget 7587/8192) to certify exact + fixed-point and floating-point bit budgets (saving 52 bits vs Horner). + 4. Pillar 4 — Complete Physical Recursive Bill & F17 Consumer Ledger Comparison + via ceiling.ceiling(...): + - Screens CONSERVED-QQ16 (F_0 + B_1_2) + #2707 (336 rank-1 decoder lines) + + #2678 (224 rank-9 H9 endpoint adapters) under ceiling.ceiling(...) at + centre = 64 vs centre = 0 against the selected record (kappa = 0.001672660197076918). + +Author: dcharb78, with AI assistance +License: Apache-2.0 +""" + +from __future__ import annotations + +from collections import Counter +from fractions import Fraction as Q +import gzip +import hashlib +import json +from pathlib import Path +import sys + +HERE = Path(__file__).resolve().parent +ROOT = ( + HERE.parents[1] + if (HERE.parents[1] / "certificates" / "selected-result.json").is_file() + else Path("/Users/dcharb/kappa_workspace/imb-repo") +) +sys.path.insert(0, str(ROOT / "research" / "complex-local-word-ceiling")) +import ceiling as C # noqa: E402 + +GRID = Q(1, 10**12) + + +def require(ok: bool, message: str) -> None: + if not ok: + raise ValueError(message) + + +def sha256_bytes(raw: bytes) -> str: + return hashlib.sha256(raw).hexdigest() + + +def git_blob_bytes(raw: bytes) -> str: + header = f"blob {len(raw)}\0".encode("ascii") + return hashlib.sha1(header + raw).hexdigest() + + +def ffloat(val: Q | float, digits: int = 12) -> str: + return f"{float(val):.{digits}f}" + + +def reg_index(token: list) -> int: + kind, idx = token + require(kind in ("L", "C"), f"unknown register kind: {kind}") + return int(idx) + (704 if kind == "C" else 0) + + +def load_authenticated_inputs() -> dict: + sources_path = HERE / "SOURCES.json" + require(sources_path.is_file(), "SOURCES.json missing") + manifest = json.loads(sources_path.read_text(encoding="utf-8")) + require(manifest.get("schema_version") == 1, "SOURCES.json schema_version != 1") + + raw_files: dict[str, bytes] = {} + for row in manifest["files"]: + rel = row["path"] + p = ROOT / rel + require(p.is_file() and not p.is_symlink(), f"missing or symlinked source: {rel}") + raw = p.read_bytes() + require(sha256_bytes(raw) == row["sha256"], f"sha256 mismatch on {rel}") + require(git_blob_bytes(raw) == row["git_blob"], f"git_blob mismatch on {rel}") + raw_files[rel] = raw + + cert_raw = gzip.decompress(raw_files["research/joint-query/certificate.json.gz"]) + require( + sha256_bytes(cert_raw) + == "2efe83c59978aa9c0db2c3e4eccc14cbfdcd3c9ce499432601b5dd34083472ef", + "decompressed certificate.json.gz payload sha256 mismatch", + ) + + return { + "selected": json.loads(raw_files["certificates/selected-result.json"].decode("utf-8")), + "conserved_summary": json.loads( + raw_files["research/joint-query/evidence/CONSERVED-QQ16.json"].decode("utf-8") + ), + "certificate": json.loads(cert_raw.decode("utf-8")), + "defect_transfer": json.loads( + raw_files["research/qq16-producer-defect-transfer/RESULT.json"].decode("utf-8") + ), + "decoder_result": json.loads( + raw_files["research/qq16-line-normalized-decoder/RESULT.json"].decode("utf-8") + ), + "ceiling_result": json.loads( + raw_files["research/complex-local-word-ceiling/RESULT.json"].decode("utf-8") + ), + } + + +def expand_program_events(packet: dict, case_name: str) -> list[tuple[list, str]]: + """Expand a case program (e.g. F_0, F_1, B_1_2) into tagged (event, origin) pairs.""" + cores = packet["core_words"] + expanded: list[tuple[list, str]] = [] + for ev in packet["programs"][case_name]: + kind = ev[0] + if kind == "retained_core": + for cev in cores[ev[1]]: + expanded.append((cev, "core")) + elif kind in ("cover_sweep", "private_sweep"): + for wev in ev[2]: + expanded.append((wev, "wrapper")) + else: + expanded.append((ev, "wrapper")) + return expanded + + +def replay_and_adjoint(side: str, case_name: str, tagged_events: list[tuple[list, str]]) -> dict: + """Execute exact 712-column forward algebraic replay, Horner path-sum replay, + dyadic integer-scaled grid exactness check, and 704-output backward adjoint replay. + """ + rows: list[dict[int, Q]] = [{i: Q(1)} for i in range(712)] + horner_all: list[Q] = [Q(1) for _ in range(712)] + horner_data: list[Q] = [Q(1) if i < 224 else Q(0) for i in range(712)] + horner_help: list[Q] = [Q(1) if 224 <= i < 704 else Q(0) for i in range(712)] + + # Integer-scaled state at grid scale D_grid (16 for F, 131072 for B) + d_grid = 16 if side == "F" else 131072 + int_rows: list[dict[int, int]] = [{i: d_grid} for i in range(712)] + non_integer_grid_steps = 0 + + peak_horner_all = Q(1) + peak_alg_data = (Q(1), -1, -1) + peak_alg_help = (Q(1), -1, -1) + peak_alg_priv = (Q(0), -1, -1) + peak_alg_total = (Q(1), -1, -1) + peak_denom = 1 + peak_num_abs = 1 + + peak_child_data = Q(0) + peak_child_help = Q(0) + peak_child_total = Q(0) + dirty_children_count = 0 + total_children_count = 0 + climb_data_count = 0 + climb_help_count = 0 + wrapper_line_data_count = 0 + wrapper_line_priv_count = 0 + + wrapper_writes_to_helpers = 0 + wrapper_reads_from_helpers = 0 + + scalar_gates: list[tuple[str, int, int, Q, str, int]] = [] + child_positions: list[tuple[int, int, str, int, str]] = [] + op_counts: Counter[str] = Counter() + event_kind_counts: Counter[str] = Counter() + + # Track state at PR #2995/#3017 event 24438 and PR #3036/#3068 events 3887, 4060 in F_0 + fault_site_checks: dict[str, bool] = {} + + for ev_idx, (ev, origin) in enumerate(tagged_events): + kind = ev[0] + event_kind_counts[kind] += 1 + if kind in ("climb", "native_line"): + total_children_count += 1 + if kind == "climb": + wire = int(ev[2]) + rk = int(ev[5]) + if wire < 224: + climb_data_count += 1 + else: + climb_help_count += 1 + else: + wire = reg_index(ev[1]) + rk = 1 + if wire < 224: + wrapper_line_data_count += 1 + else: + wrapper_line_priv_count += 1 + if 224 <= wire < 704: + wrapper_writes_to_helpers += 1 + + row = rows[wire] + d_l1 = sum((abs(v) for k, v in row.items() if k < 224), Q(0)) + h_l1 = sum((abs(v) for k, v in row.items() if 224 <= k < 704), Q(0)) + t_l1 = d_l1 + h_l1 + if h_l1 > 0: + dirty_children_count += 1 + if d_l1 > peak_child_data: + peak_child_data = d_l1 + if h_l1 > peak_child_help: + peak_child_help = h_l1 + if t_l1 > peak_child_total: + peak_child_total = t_l1 + child_positions.append((len(scalar_gates), wire, kind, rk, origin)) + + elif kind == "scalar": + gate = ev[1] + op = str(gate[0]) + op_counts[op] += 1 + at = reg_index(gate[1]) + if origin == "wrapper" and 224 <= at < 704: + wrapper_writes_to_helpers += 1 + + if side == "F" and ev_idx in (3887, 4060, 24438): + # Check the exact instructions cited in PR #2995/#3017/#3036/#3068 + fault_site_checks[f"event_{ev_idx}_op"] = ( + op == "add" + and all(isinstance(v, int) for v in int_rows[at].values()) + ) + + if op == "clear": + rows[at] = {} + int_rows[at] = {} + horner_all[at] = Q(0) + horner_data[at] = Q(0) + horner_help[at] = Q(0) + scalar_gates.append(("clear", at, -1, Q(0), origin, ev_idx)) + elif op == "scale": + c = Q(int(gate[2]), int(gate[3])) + rows[at] = {k: v * c for k, v in rows[at].items()} + new_int: dict[int, int] = {} + for k, iv in int_rows[at].items(): + prod = iv * c.numerator + if prod % c.denominator != 0: + non_integer_grid_steps += 1 + new_int[k] = prod // c.denominator + int_rows[at] = new_int + horner_all[at] *= abs(c) + horner_data[at] *= abs(c) + horner_help[at] *= abs(c) + if horner_all[at] > peak_horner_all: + peak_horner_all = horner_all[at] + scalar_gates.append(("scale", at, -1, c, origin, ev_idx)) + elif op == "add": + src = reg_index(gate[2]) + if origin == "wrapper" and 224 <= src < 704: + wrapper_reads_from_helpers += 1 + c = Q(int(gate[3]), int(gate[4])) + dst_row = rows[at] + for k, v in rows[src].items(): + nv = dst_row.get(k, Q(0)) + c * v + if nv: + dst_row[k] = nv + else: + dst_row.pop(k, None) + + dst_int = int_rows[at] + for k, iv in int_rows[src].items(): + prod = iv * c.numerator + if prod % c.denominator != 0: + non_integer_grid_steps += 1 + niv = dst_int.get(k, 0) + (prod // c.denominator) + if niv: + dst_int[k] = niv + else: + dst_int.pop(k, None) + + ac = abs(c) + if ac.numerator * horner_all[src] > peak_horner_all: + peak_horner_all = ac.numerator * horner_all[src] + horner_all[at] += ac * horner_all[src] + if horner_all[at] > peak_horner_all: + peak_horner_all = horner_all[at] + horner_data[at] += ac * horner_data[src] + horner_help[at] += ac * horner_help[src] + scalar_gates.append(("add", at, src, c, origin, ev_idx)) + else: + require(False, f"unexpected scalar op: {op}") + + row = rows[at] + if at < 704: + d_l1 = sum((abs(v) for k, v in row.items() if k < 224), Q(0)) + h_l1 = sum((abs(v) for k, v in row.items() if 224 <= k < 704), Q(0)) + t_l1 = sum(abs(v) for v in row.values()) + if d_l1 > peak_alg_data[0]: + peak_alg_data = (d_l1, ev_idx, at) + if h_l1 > peak_alg_help[0]: + peak_alg_help = (h_l1, ev_idx, at) + if t_l1 > peak_alg_total[0]: + peak_alg_total = (t_l1, ev_idx, at) + else: + p_l1 = sum(abs(v) for v in row.values()) + if p_l1 > peak_alg_priv[0]: + peak_alg_priv = (p_l1, ev_idx, at) + + for v in row.values(): + if v.denominator > peak_denom: + peak_denom = v.denominator + if abs(v.numerator) > peak_num_abs: + peak_num_abs = abs(v.numerator) + + require(non_integer_grid_steps == 0, f"dyadic grid {d_grid} had non-integer steps") + # Confirm integer-scaled rows match rational rows exactly at termination + for i in range(712): + require( + {k: Q(iv, d_grid) for k, iv in int_rows[i].items()} == rows[i], + f"int_rows mismatch on wire {i}", + ) + + final_data_l1 = max(sum(abs(v) for v in rows[i].values()) for i in range(224)) + final_help_leak = sum( + sum(abs(v) for k, v in rows[i].items() if k >= 224) for i in range(224) + ) + require(final_help_leak == 0, f"helper leak on completed data outputs in {case_name}") + restored_helpers = sum(1 for i in range(224, 704) if rows[i] == {i: Q(1)}) + require(restored_helpers == 480, f"unrestored helpers in {case_name}: {480 - restored_helpers}") + zero_privates = sum(1 for i in range(704, 712) if rows[i] == {}) + require(zero_privates == 8, f"nonzero terminal private C registers in {case_name}") + + horner_width = 0 + while (1 << horner_width) < peak_horner_all: + horner_width += 1 + alg_width = 0 + while (1 << alg_width) <= peak_alg_total[0]: + alg_width += 1 + + # 2. Backward Adjoint Replay across all 704 terminal outputs (0..223 data, 224..703 helpers) + adj: list[dict[int, Q]] = [{w: Q(1)} if w < 704 else {} for w in range(712)] + children_at_step: dict[int, list[tuple[int, str, int, str]]] = {} + for s_idx, wire, kind, rk, origin in child_positions: + children_at_step.setdefault(s_idx, []).append((wire, kind, rk, origin)) + + child_err_total = [Q(0) for _ in range(704)] + child_err_wrap = [Q(0) for _ in range(704)] + child_err_core = [Q(0) for _ in range(704)] + add_err_total = [Q(0) for _ in range(704)] + scale_err_total = [Q(0) for _ in range(704)] + gate_err_total = [Q(0) for _ in range(704)] + gate_err_wrap = [Q(0) for _ in range(704)] + gate_err_core = [Q(0) for _ in range(704)] + max_single_child_to_data = Q(0) + + for step_idx in range(len(scalar_gates), -1, -1): + if step_idx in children_at_step: + for wire, _kind, _rk, origin in children_at_step[step_idx]: + for out_i, coeff in adj[wire].items(): + ac = abs(coeff) + child_err_total[out_i] += ac + if origin == "wrapper": + child_err_wrap[out_i] += ac + else: + child_err_core[out_i] += ac + if out_i < 224 and ac > max_single_child_to_data: + max_single_child_to_data = ac + if step_idx == 0: + break + op, at, src, c, origin, _ev_idx = scalar_gates[step_idx - 1] + if op == "add": + for out_i, coeff in adj[at].items(): + ac = abs(coeff) + add_err_total[out_i] += ac + gate_err_total[out_i] += ac + if origin == "wrapper": + gate_err_wrap[out_i] += ac + else: + gate_err_core[out_i] += ac + elif op == "scale": + for out_i, coeff in adj[at].items(): + ac = abs(coeff) + scale_err_total[out_i] += ac + gate_err_total[out_i] += ac + if origin == "wrapper": + gate_err_wrap[out_i] += ac + else: + gate_err_core[out_i] += ac + + if op == "clear": + adj[at] = {} + elif op == "scale": + adj[at] = {out_i: v * c for out_i, v in adj[at].items()} + elif op == "add": + if adj[at]: + src_adj = adj[src] + for out_i, v in adj[at].items(): + nv = src_adj.get(out_i, Q(0)) + c * v + if nv: + src_adj[out_i] = nv + else: + src_adj.pop(out_i, None) + + # Verify exact transpose duality: at step 0, adj[w][i] == rows[i][w] for all i, w in 0..703! + for i in range(704): + recon_row = {w: adj[w][i] for w in range(704) if i in adj[w]} + require(recon_row == rows[i], f"backward adjoint transpose mismatch on output {i}") + + require(max(child_err_wrap[224:704]) == 0, "wrapper child sensitivity to helpers != 0") + require(max(gate_err_wrap[224:704]) == 0, "wrapper gate sensitivity to helpers != 0") + require(wrapper_writes_to_helpers == 0, "wrapper wrote to helpers") + require(wrapper_reads_from_helpers == 0, "wrapper read from helpers") + + return { + "case": case_name, + "side": side, + "total_events": len(tagged_events), + "event_kinds": dict(sorted(event_kind_counts.items())), + "scalar_gates": len(scalar_gates), + "scalar_op_counts": dict(sorted(op_counts.items())), + "total_children": total_children_count, + "dirty_children": dirty_children_count, + "climb_data_children": climb_data_count, + "climb_helper_children": climb_help_count, + "wrapper_line_data_children": wrapper_line_data_count, + "wrapper_line_private_children": wrapper_line_priv_count, + "horner_path_sum_bound": str(peak_horner_all), + "horner_ceiling_bits": horner_width, + "peak_interior_data_l1": int(peak_alg_data[0]), + "peak_interior_data_event": peak_alg_data[1], + "peak_interior_data_register": peak_alg_data[2], + "peak_interior_helper_l1": int(peak_alg_help[0]), + "peak_interior_helper_event": peak_alg_help[1], + "peak_interior_helper_register": peak_alg_help[2], + "peak_interior_private_l1": int(peak_alg_priv[0]), + "peak_interior_private_event": peak_alg_priv[1], + "peak_interior_private_register": peak_alg_priv[2], + "peak_interior_total_l1": int(peak_alg_total[0]), + "peak_interior_total_event": peak_alg_total[1], + "peak_interior_total_register": peak_alg_total[2], + "algebraic_ceiling_bits": alg_width, + "dynamic_range_collapse_bits": horner_width - alg_width, + "max_dyadic_denominator": peak_denom, + "max_dyadic_fractional_bits": peak_denom.bit_length() - 1, + "max_numerator_abs": peak_num_abs, + "non_integer_grid_steps": non_integer_grid_steps, + "peak_child_entry_data_l1": int(peak_child_data), + "peak_child_entry_helper_l1": int(peak_child_help), + "peak_child_entry_total_l1": int(peak_child_total), + "terminal_data_l1": int(final_data_l1), + "terminal_helper_leak_on_data": int(final_help_leak), + "terminal_restored_helpers": restored_helpers, + "terminal_zero_private_registers": zero_privates, + "adjoint_sensitivities": { + "max_single_child_to_data": str(max_single_child_to_data), + "data_X_child_gain": str(max(child_err_total[:112])), + "data_X_add_gain": str(max(add_err_total[:112])), + "data_X_scale_gain": str(max(scale_err_total[:112])), + "data_X_gate_gain": str(max(gate_err_total[:112])), + "data_Y_child_gain": str(max(child_err_total[112:224])), + "data_Y_add_gain": str(max(add_err_total[112:224])), + "data_Y_scale_gain": str(max(scale_err_total[112:224])), + "data_Y_gate_gain": str(max(gate_err_total[112:224])), + "data_all_child_gain": str(max(child_err_total[:224])), + "data_all_wrapper_child_gain": str(max(child_err_wrap[:224])), + "data_all_core_child_gain": str(max(child_err_core[:224])), + "data_all_add_gain": str(max(add_err_total[:224])), + "data_all_scale_gain": str(max(scale_err_total[:224])), + "data_all_gate_gain": str(max(gate_err_total[:224])), + "data_all_gate_gain_float": round(float(max(gate_err_total[:224])), 4), + "helpers_wrapper_child_gain": str(max(child_err_wrap[224:704])), + "helpers_wrapper_gate_gain": str(max(gate_err_wrap[224:704])), + "helpers_core_child_gain": str(max(child_err_core[224:704])), + "helpers_add_gain": str(max(add_err_total[224:704])), + "helpers_scale_gain": str(max(scale_err_total[224:704])), + "helpers_gate_gain": str(max(gate_err_total[224:704])), + "helpers_gate_gain_float": round(float(max(gate_err_total[224:704])), 4), + }, + "wrapper_helper_isolation": { + "wrapper_writes_to_helpers": wrapper_writes_to_helpers, + "wrapper_reads_from_helpers": wrapper_reads_from_helpers, + "wrapper_child_to_helper_gain": 0, + "wrapper_gate_to_helper_gain": 0, + "transpose_duality_704_rows_verified": True, + }, + "fault_site_checks": fault_site_checks, + } + + +def run_negative_controls(packet: dict, f_ledger: dict, b_ledger: dict, p4: dict) -> dict: + """Execute the 6 behavioral negative controls.""" + # Control 1: Horner path-sum triangle bound vs exact algebraic cancellation + require( + f_ledger["horner_ceiling_bits"] == 55 + and f_ledger["algebraic_ceiling_bits"] == 18 + and f_ledger["dynamic_range_collapse_bits"] == 37, + "Control 1 failed on F", + ) + require( + b_ledger["horner_ceiling_bits"] == 73 + and b_ledger["algebraic_ceiling_bits"] == 21 + and b_ledger["dynamic_range_collapse_bits"] == 52, + "Control 1 failed on B", + ) + c1 = { + "F_horner_bits": 55, + "F_exact_bits": 18, + "F_collapse_bits": 37, + "B_horner_bits": 73, + "B_exact_bits": 21, + "B_collapse_bits": 52, + "status": "PASS", + } + + # Control 2: Omitting the post-B cleanup_tail / full_frame_cleanup restoration suffix + f_events = expand_program_events(packet, "F_1") + b_events = expand_program_events(packet, "B_1_2") + f_cut = next(i for i, (e, _) in enumerate(f_events) if e == ["phase", "cleanup_tail"]) + b_cut = next(i for i, (e, _) in enumerate(b_events) if e == ["phase", "cleanup_tail"]) + + def count_unrestored_at_cut(tagged: list[tuple[list, str]], cut: int) -> tuple[int, int]: + rows = [{i: Q(1)} for i in range(712)] + for ev, _ in tagged[:cut]: + if ev[0] == "scalar": + g = ev[1] + op, at = g[0], reg_index(g[1]) + if op == "clear": + rows[at] = {} + elif op == "scale": + c = Q(int(g[2]), int(g[3])) + rows[at] = {k: v * c for k, v in rows[at].items()} + elif op == "add": + src, c = reg_index(g[2]), Q(int(g[3]), int(g[4])) + dst = rows[at] + for k, v in rows[src].items(): + nv = dst.get(k, Q(0)) + c * v + if nv: + dst[k] = nv + else: + dst.pop(k, None) + unrest = sum(1 for i in range(224, 704) if rows[i] != {i: Q(1)}) + max_h = int( + max(sum((abs(v) for k, v in rows[i].items() if 224 <= k < 704), Q(0)) for i in range(224, 704)) + ) + return unrest, max_h + + f_unrest, f_max_h = count_unrestored_at_cut(f_events, f_cut) + b_unrest, b_max_h = count_unrestored_at_cut(b_events, b_cut) + require(f_unrest == 480 and b_unrest == 395, f"Control 2 unexpected counts: {f_unrest}, {b_unrest}") + c2 = { + "F_cleanup_tail_cut_index": f_cut, + "F_unrestored_helpers_at_cut": f_unrest, + "F_max_helper_l1_at_cut": f_max_h, + "B_cleanup_tail_cut_index": b_cut, + "B_unrestored_helpers_at_cut": b_unrest, + "B_max_helper_l1_at_cut": b_max_h, + "status": "REJECTS_TRUNCATED_RESTORATION", + } + + # Control 3: Omitting owned private C0..C7 clear gates (treating C0..C7 as self-restored) + def replay_without_private_clears(tagged: list[tuple[list, str]]) -> tuple[int, int]: + rows = [{i: Q(1)} for i in range(712)] + for ev, _ in tagged: + if ev[0] == "scalar": + g = ev[1] + op, at = g[0], reg_index(g[1]) + if op == "clear": + continue + elif op == "scale": + c = Q(int(g[2]), int(g[3])) + rows[at] = {k: v * c for k, v in rows[at].items()} + elif op == "add": + src, c = reg_index(g[2]), Q(int(g[3]), int(g[4])) + dst = rows[at] + for k, v in rows[src].items(): + nv = dst.get(k, Q(0)) + c * v + if nv: + dst[k] = nv + else: + dst.pop(k, None) + dirty_priv = sum(1 for i in range(704, 712) if rows[i] != {}) + data_leak = sum(1 for i in range(224) if any(k >= 704 for k in rows[i])) + return dirty_priv, data_leak + + f_dpriv, f_dleak = replay_without_private_clears(f_events) + b_dpriv, b_dleak = replay_without_private_clears(b_events) + require( + f_dpriv == 8 and f_dleak == 112 and b_dpriv == 8 and b_dleak == 8, + "Control 3 failed to detect private C0..C7 leak", + ) + c3 = { + "F_dirty_private_registers_without_clear": f_dpriv, + "F_data_outputs_corrupted_by_private_inputs": f_dleak, + "B_dirty_private_registers_without_clear": b_dpriv, + "B_data_outputs_corrupted_by_private_inputs": b_dleak, + "status": "REJECTS_OMITTED_PRIVATE_CLEARS", + } + + # Control 4: Injecting a synthetic helper read from A_copy wire L[112] in F_1 + # immediately breaks helpers_wrapper_child_gain == 0 + mut_f_events = list(f_events) + [ + (["scalar", ["add", ["L", 224], ["L", 112], 1, 1], "I"], "wrapper") + ] + # Run backward adjoint on mut_f_events to check wrapper child sensitivity on helper 224 + adj_mut: list[dict[int, Q]] = [{224: Q(1)} if w == 224 else {} for w in range(712)] + wrap_child_sens_on_224 = Q(0) + for ev, origin in reversed(mut_f_events): + if ev[0] in ("climb", "native_line"): + wire = int(ev[2]) if ev[0] == "climb" else reg_index(ev[1]) + if origin == "wrapper" and 224 in adj_mut[wire]: + wrap_child_sens_on_224 += abs(adj_mut[wire][224]) + elif ev[0] == "scalar": + g = ev[1] + op, at = g[0], reg_index(g[1]) + if op == "clear": + adj_mut[at] = {} + elif op == "scale": + c = Q(int(g[2]), int(g[3])) + adj_mut[at] = {k: v * c for k, v in adj_mut[at].items()} + elif op == "add": + src, c = reg_index(g[2]), Q(int(g[3]), int(g[4])) + if adj_mut[at]: + for k, v in adj_mut[at].items(): + nv = adj_mut[src].get(k, Q(0)) + c * v + if nv: + adj_mut[src][k] = nv + else: + adj_mut[src].pop(k, None) + require(wrap_child_sens_on_224 == 1, f"Control 4 expected 1, got {wrap_child_sens_on_224}") + c4 = { + "synthetic_wrapper_helper_read_gain": int(wrap_child_sens_on_224), + "unperturbed_wrapper_helper_child_gain": 0, + "status": "REJECTS_WRAPPER_HELPER_COUPLING", + } + + # Control 5: Perturbing the sign at PR #3036/#3068 helper-cancellation event 3,887 + # and peak interior L1 event 24,611 in F_1 breaks both helper restoration (136 unrestored) + # and data cleanliness (4 data outputs with helper leak; terminal max data L1 = 270668033/4096 vs 27). + rows_c5 = [{i: Q(1)} for i in range(712)] + for idx, (ev, _) in enumerate(f_events): + if ev[0] == "scalar": + g = ev[1] + op, at = g[0], reg_index(g[1]) + if op == "clear": + rows_c5[at] = {} + elif op == "scale": + c = Q(int(g[2]), int(g[3])) + rows_c5[at] = {k: v * c for k, v in rows_c5[at].items()} + elif op == "add": + src, c = reg_index(g[2]), Q(int(g[3]), int(g[4])) + if idx in (3887, 24611): + c = -c + dst = rows_c5[at] + for k, v in rows_c5[src].items(): + nv = dst.get(k, Q(0)) + c * v + if nv: + dst[k] = nv + else: + dst.pop(k, None) + c5_unrestored_helpers = sum(1 for i in range(224, 704) if rows_c5[i] != {i: Q(1)}) + c5_data_helper_leak = sum(1 for i in range(224) if any(224 <= k < 704 for k in rows_c5[i])) + c5_terminal_max_data_l1 = max(sum(abs(v) for v in rows_c5[i].values()) for i in range(224)) + require( + c5_unrestored_helpers == 136 + and c5_data_helper_leak == 4 + and c5_terminal_max_data_l1 == Q(270668033, 4096), + "Control 5 sign perturbation mismatch", + ) + c5 = { + "perturbed_event_indices": [3887, 24611], + "unrestored_helpers_after_sign_flip": c5_unrestored_helpers, + "data_outputs_with_helper_leak_after_sign_flip": c5_data_helper_leak, + "terminal_max_data_l1_after_sign_flip": str(c5_terminal_max_data_l1), + "unperturbed_terminal_max_data_l1": "27", + "status": "REJECTS_SINGLE_SIGN_PERTURBATION", + } + + # Control 6: Evaluating CONSERVED-QQ16 + #2707 under ceiling.ceiling(...) with unchanged centre=64 + require( + Q(p4["profiles"]["qq16_pair_plus_decoder_centre64"]["kappa_cap_dec"]) + < Q(p4["selected_kappa_dec"]), + "Control 6 failed: centre=64 profile should lie below selected kappa", + ) + c6 = { + "selected_kappa_dec": p4["selected_kappa_dec"], + "qq16_pair_plus_decoder_centre64_kappa_cap": p4["profiles"][ + "qq16_pair_plus_decoder_centre64" + ]["kappa_cap_dec"], + "qq16_pair_plus_decoder_plus_h9_centre64_kappa_cap": p4["profiles"][ + "qq16_pair_plus_decoder_plus_h9_centre64" + ]["kappa_cap_dec"], + "qq16_pair_plus_decoder_centre0_kappa_cap": p4["profiles"][ + "qq16_pair_plus_decoder_centre0" + ]["kappa_cap_dec"], + "status": "CONFIRMS_CENTRE_AND_CONSUMER_BOTTLENECK", + } + + return { + "control_1_horner_vs_exact_algebraic_collapse": c1, + "control_2_truncated_restoration_suffix": c2, + "control_3_omitted_private_c_clears": c3, + "control_4_synthetic_wrapper_helper_coupling": c4, + "control_5_single_sign_perturbation_at_peak_helper_event": c5, + "control_6_uncharged_vs_charged_consumer_ceiling": c6, + } + + +def verify_pillar_3_and_4( + data: dict, f_ledger: dict, b_ledger: dict +) -> tuple[dict, dict]: + """Compute Pillar 3 (precision & #2965 coupling) and Pillar 4 (ceiling.ceiling screen).""" + dt = data["defect_transfer"] + require( + max(Q(r["l1"]) for r in dt["operators"]["F0"]) == 49, + "pinned #2965 F0 inverse norm != 49", + ) + require( + max(Q(r["l1"]) for r in dt["operators"]["D"]) == 1923, + "pinned #2965 decoder D norm != 1923", + ) + require( + dt["controls"]["normalized_error_bound"] == "7587/8192", + "pinned #2965 normalized_error_bound != 7587/8192", + ) + + f_tot_amp = Q(f_ledger["adjoint_sensitivities"]["data_all_child_gain"]) + Q( + f_ledger["adjoint_sensitivities"]["data_all_gate_gain"] + ) + b_tot_amp = Q(b_ledger["adjoint_sensitivities"]["data_all_child_gain"]) + Q( + b_ledger["adjoint_sensitivities"]["data_all_gate_gain"] + ) + require(f_tot_amp == Q(2234071313, 131072), "unexpected F total amplification") + require(b_tot_amp == Q(3690685, 4), "unexpected B total amplification") + + # Bit-width derivation for target accuracy H * 2^-beta under #2965 sufficient budget: + # eps_F <= H * 2^(-beta - 8), eps_B <= H * 2^(-beta - 13) + # 1. Exact common-grid scalar execution (eps_gate = 0): + # - F: 4 fractional grid bits, child gain 132 < 2^8, child entry norm <= 124 < 2^7 + # => child fractional precision >= 8 + 7 + 8 + beta = 23 + beta bits + # - B: 17 fractional grid bits, child gain 381/2 < 2^8, child entry norm <= 166 < 2^8 + # => child fractional precision >= 13 + 8 + 8 + beta = 29 + beta bits + # With 21 signed integer headroom bits (peak interior L1 = 1,154,896 < 2^20.14), + # total fixed-point width is at most 21 + 29 + beta = 50 + beta bits! + # 2. General rounded-gate + rounded-child execution: + # - F: peak interior 18 bits, total adjoint gain < 2^15, tolerance 2^(-beta-8) + # => p_F = 18 + 15 + 8 + beta = 41 + beta fractional bits (59 + beta total bits) + # - B: peak interior 21 bits, total adjoint gain < 2^20, tolerance 2^(-beta-13) + # => p_B = 21 + 20 + 13 + beta = 54 + beta fractional bits (75 + beta total bits, + # saving 52 bits vs the 127 + beta bits implied by the 73-bit Horner bound!). + p3 = { + "pr2965_F0_inverse_l1_norm": 49, + "pr2965_decoder_D_l1_norm": 1923, + "pr2965_normalized_error_budget": "7587/8192", + "F_dyadic_grid_fractional_bits": 4, + "B_dyadic_grid_fractional_bits": 17, + "F_scalar_gates_exact_on_grid": 21025, + "B_scalar_gates_exact_on_grid": 21401, + "F_total_adjoint_gain": str(f_tot_amp), + "F_total_adjoint_gain_bits": 15, + "B_total_adjoint_gain": str(b_tot_amp), + "B_total_adjoint_gain_bits": 20, + "common_grid_child_fractional_bits_offset": 29, + "common_grid_total_fixed_point_bits_offset": 50, + "rounded_gate_B_fractional_bits_offset": 54, + "rounded_gate_B_total_bits_offset": 75, + "horner_bound_B_total_bits_offset": 127, + "dynamic_range_bits_saved_in_B": 52, + "dynamic_range_bits_saved_in_F": 37, + } + + # Pillar 4: Physical Recursive Bill & ceiling.ceiling(...) comparison + dec_res = data["decoder_result"] + require(dec_res["events"] == 3823, "unexpected #2707 events") + require( + dec_res["trace"] + == { + "add": 2704, + "begin": 3, + "checkpoint": 1, + "clear": 312, + "end": 3, + "line": 336, + "map": 464, + "quarter_ADD": 896, + "unit_ADD": 1808, + }, + "unexpected #2707 decoder trace", + ) + require(dec_res["two_sided_224_array_inverse"] is True, "unexpected #2707 two_sided_224_array_inverse") + + def eval_profile(prof: dict[int, int | Q], centre: int | Q) -> dict: + lo, hi = C.ceiling(prof, 73, 896, 9, centre, grid=GRID) + kap_hi = hi / (1 + hi) + local_mass = sum(r * Q(n) for r, n in prof.items()) + return { + "centre_per_call": str(centre), + "local_mass_per_call": str(local_mass), + "a_lo": str(lo), + "a_hi": str(hi), + "a_cap_dec": ffloat(hi), + "kappa_cap_dec": ffloat(kap_hi), + } + + sel_prof = {1: 2412, 2: 418, 3: 432, 4: 142, 5: 82, 8: 8} + qq16_f_prof = {1: 2420, 2: 418, 3: 432, 4: 142, 5: 82} + qq16_b_prof = {1: 2436, 2: 418, 3: 432, 4: 142, 5: 82} + # 2-call pair (F_0 + B_1_2) + 336 rank-1 decoder lines (168 per call): + # under centre = 64 ( retaining the 8 rank-8 centre charge per call ): + qq16_pair_dec_c64 = {1: 2596, 2: 418, 3: 432, 4: 142, 5: 82, 8: 8} + # plus 224 rank-9 H9 endpoint adapters (112 per call) to exit F17: + qq16_pair_dec_h9_c64 = {1: 2596, 2: 418, 3: 432, 4: 142, 5: 82, 8: 8, 9: 112} + # under centre = 0 (if global coverage law eliminates the 64-per-call centre charge): + qq16_pair_dec_c0 = {1: 2596, 2: 418, 3: 432, 4: 142, 5: 82} + qq16_pair_dec_h9_c0 = {1: 2596, 2: 418, 3: 432, 4: 142, 5: 82, 9: 112} + + p4 = { + "selected_kappa_dec": str(data["selected"]["decimal"]), + "selected_ceiling_a_cap_dec": "0.001690054110", + "selected_ceiling_kappa_cap_dec": "0.001687202646", + "producer_F_invoice": data["conserved_summary"]["invoices"]["F"], + "producer_B_invoice": data["conserved_summary"]["invoices"]["B"], + "decoder_pr2707_trace": dec_res["trace"], + "decoder_pr2707_events": dec_res["events"], + "profiles": { + "selected_baseline_centre64": eval_profile(sel_prof, 64), + "qq16_F_only_centre0": eval_profile(qq16_f_prof, 0), + "qq16_B_only_centre0": eval_profile(qq16_b_prof, 0), + "qq16_pair_plus_decoder_centre64": eval_profile(qq16_pair_dec_c64, 64), + "qq16_pair_plus_decoder_plus_h9_centre64": eval_profile(qq16_pair_dec_h9_c64, 64), + "qq16_pair_plus_decoder_centre0": eval_profile(qq16_pair_dec_c0, 0), + "qq16_pair_plus_decoder_plus_h9_centre0": eval_profile(qq16_pair_dec_h9_c0, 0), + }, + } + return p3, p4 + + +def compute() -> dict: + data = load_authenticated_inputs() + packet = data["certificate"] + conserved = data["conserved_summary"] + + # Replay F_0, F_1, and B_1_2 and verify across all 37 native cases (9 F + 28 B) + f0_events = expand_program_events(packet, "F_0") + f1_events = expand_program_events(packet, "F_1") + b12_events = expand_program_events(packet, "B_1_2") + + f0_ledger = replay_and_adjoint("F", "F_0", f0_events) + f1_ledger = replay_and_adjoint("F", "F_1", f1_events) + b12_ledger = replay_and_adjoint("B", "B_1_2", b12_events) + + # Confirm all 9 F_s cases have identical scalar projections and all 28 B_s_t cases match B_1_2 + f1_scalars = [e[1] for e, _ in f1_events if e[0] == "scalar"] + b12_scalars = [e[1] for e, _ in b12_events if e[0] == "scalar"] + for s in range(9): + ev_s = expand_program_events(packet, f"F_{s}") + require( + len(ev_s) == (26099 if s == 0 else 26387), + f"unexpected event count in F_{s}", + ) + require( + [e[1] for e, _ in ev_s if e[0] == "scalar"] == f1_scalars, + f"scalar projection drift in F_{s}", + ) + for s in range(1, 8): + for t in range(s + 1, 9): + ev_st = expand_program_events(packet, f"B_{s}_{t}") + require(len(ev_st) == 27019, f"unexpected event count in B_{s}_{t}") + require( + [e[1] for e, _ in ev_st if e[0] == "scalar"] == b12_scalars, + f"scalar projection drift in B_{s}_{t}", + ) + + # Cross-check against pinned CONSERVED-QQ16.json invoices + require( + f1_ledger["horner_path_sum_bound"] + == conserved["invoices"]["F"]["formal_prefix"]["formal_triangle_Horner_bound"], + "F Horner bound mismatch vs CONSERVED-QQ16.json", + ) + require( + b12_ledger["horner_path_sum_bound"] + == conserved["invoices"]["B"]["formal_prefix"]["formal_triangle_Horner_bound"], + "B Horner bound mismatch vs CONSERVED-QQ16.json", + ) + + p3, p4 = verify_pillar_3_and_4(data, f1_ledger, b12_ledger) + controls = run_negative_controls(packet, f1_ledger, b12_ledger, p4) + + return { + "schema_version": 1, + "status": "PASS_QQ16_INTERIOR_DYNAMIC_RANGE_AND_ADJOINT_LEDGER", + "summary": { + "total_columns_replayed": 712, + "data_columns": 224, + "dirty_helper_columns": 480, + "private_c_columns": 8, + "F0_events": f0_ledger["total_events"], + "F_events": f1_ledger["total_events"], + "B_events": b12_ledger["total_events"], + "F_scalar_gates": f1_ledger["scalar_gates"], + "B_scalar_gates": b12_ledger["scalar_gates"], + "F_total_children": f1_ledger["total_children"], + "F_dirty_children": f1_ledger["dirty_children"], + "B_total_children": b12_ledger["total_children"], + "B_dirty_children": b12_ledger["dirty_children"], + "F_horner_bits": f1_ledger["horner_ceiling_bits"], + "F_exact_algebraic_bits": f1_ledger["algebraic_ceiling_bits"], + "F_dynamic_range_collapse_bits": f1_ledger["dynamic_range_collapse_bits"], + "B_horner_bits": b12_ledger["horner_ceiling_bits"], + "B_exact_algebraic_bits": b12_ledger["algebraic_ceiling_bits"], + "B_dynamic_range_collapse_bits": b12_ledger["dynamic_range_collapse_bits"], + "F_peak_interior_data_l1": f1_ledger["peak_interior_data_l1"], + "F_peak_interior_helper_l1": f1_ledger["peak_interior_helper_l1"], + "F_peak_interior_private_l1": f1_ledger["peak_interior_private_l1"], + "F_peak_interior_total_l1": f1_ledger["peak_interior_total_l1"], + "B_peak_interior_data_l1": b12_ledger["peak_interior_data_l1"], + "B_peak_interior_helper_l1": b12_ledger["peak_interior_helper_l1"], + "B_peak_interior_private_l1": b12_ledger["peak_interior_private_l1"], + "B_peak_interior_total_l1": b12_ledger["peak_interior_total_l1"], + "F_max_dyadic_denominator": f1_ledger["max_dyadic_denominator"], + "B_max_dyadic_denominator": b12_ledger["max_dyadic_denominator"], + "F_peak_child_entry_l1": f1_ledger["peak_child_entry_total_l1"], + "B_peak_child_entry_l1": b12_ledger["peak_child_entry_total_l1"], + "F_data_child_gain": f1_ledger["adjoint_sensitivities"]["data_all_child_gain"], + "F_data_gate_gain": f1_ledger["adjoint_sensitivities"]["data_all_gate_gain"], + "F_helper_wrapper_child_gain": 0, + "F_helper_core_child_gain": f1_ledger["adjoint_sensitivities"][ + "helpers_core_child_gain" + ], + "F_helper_gate_gain": f1_ledger["adjoint_sensitivities"]["helpers_gate_gain"], + "B_data_child_gain": b12_ledger["adjoint_sensitivities"]["data_all_child_gain"], + "B_data_gate_gain": b12_ledger["adjoint_sensitivities"]["data_all_gate_gain"], + "B_helper_wrapper_child_gain": 0, + "B_helper_core_child_gain": b12_ledger["adjoint_sensitivities"][ + "helpers_core_child_gain" + ], + "B_helper_gate_gain": b12_ledger["adjoint_sensitivities"]["helpers_gate_gain"], + "common_grid_fixed_point_bits_offset": p3[ + "common_grid_total_fixed_point_bits_offset" + ], + "rounded_gate_B_total_bits_offset": p3["rounded_gate_B_total_bits_offset"], + "horner_B_total_bits_offset": p3["horner_bound_B_total_bits_offset"], + "qq16_pair_plus_decoder_centre64_a_cap": p4["profiles"][ + "qq16_pair_plus_decoder_centre64" + ]["a_cap_dec"], + "qq16_pair_plus_decoder_centre64_kappa_cap": p4["profiles"][ + "qq16_pair_plus_decoder_centre64" + ]["kappa_cap_dec"], + "qq16_pair_plus_decoder_plus_h9_centre64_kappa_cap": p4["profiles"][ + "qq16_pair_plus_decoder_plus_h9_centre64" + ]["kappa_cap_dec"], + "qq16_pair_plus_decoder_centre0_a_cap": p4["profiles"][ + "qq16_pair_plus_decoder_centre0" + ]["a_cap_dec"], + "qq16_pair_plus_decoder_centre0_kappa_cap": p4["profiles"][ + "qq16_pair_plus_decoder_centre0" + ]["kappa_cap_dec"], + }, + "pillar1_interior_dynamic_range": { + "F_0": f0_ledger, + "F_1_to_8": f1_ledger, + "B_1_2_to_7_8": b12_ledger, + "verified_cases_count": 37, + }, + "pillar2_backward_adjoint_ledger": { + "F": f1_ledger["adjoint_sensitivities"], + "B": b12_ledger["adjoint_sensitivities"], + }, + "pillar3_dyadic_grid_and_precision_floor": p3, + "pillar4_physical_recursive_bill_and_ceilings": p4, + "negative_controls": controls, + } + + +def main() -> int: + write = "--write" in sys.argv[1:] + result = compute() + text = json.dumps(result, indent=2, sort_keys=True, ensure_ascii=True) + "\n" + out = HERE / "RESULT.json" + if write: + out.write_text(text, encoding="utf-8", newline="\n") + else: + require(out.is_file(), "RESULT.json missing; run with --write first") + require( + out.read_bytes() == text.encode("utf-8"), + "RESULT.json does not match deterministic recomputation", + ) + s = result["summary"] + print( + "PASS_QQ16_INTERIOR_DYNAMIC_RANGE_AND_ADJOINT_LEDGER", + "F_collapse_bits", + s["F_dynamic_range_collapse_bits"], + "B_collapse_bits", + s["B_dynamic_range_collapse_bits"], + "F_peak_l1", + s["F_peak_interior_total_l1"], + "B_peak_l1", + s["B_peak_interior_total_l1"], + "F_child_gain", + s["F_data_child_gain"], + "B_child_gain", + s["B_data_child_gain"], + "centre64_kappa_cap", + s["qq16_pair_plus_decoder_centre64_kappa_cap"], + "no_new_kappa", + ) + return 0 + + +if __name__ == "__main__": + sys.exit(main())