From 0ceacacb7e8572cc408f12a194c6bd55c9f921c1 Mon Sep 17 00:00:00 2001 From: DaysSky <88261516+DaysSky@users.noreply.github.com> Date: Sat, 24 Oct 2026 00:13:02 +0900 Subject: [PATCH 1/5] research: materialize the p19 coded-reverse word and price it (draft, verification open) Adds the p19 coded-reverse packages: the exact physical thin source and local S/L/R boundary pair, and the materialized controller word with its paid accounting. The word is emitted as an explicit 259-gate listing and replayed against the standard word: 19 gauge loads, 19 unloads, 20 forward stages, 19 reverse stages, 19 letters, 36 retained idle calls, 108 bridges and 19 closing swaps. Replay differs on 0 of 229,376 entries at p=2 and 0 of 2,179,072 at p=19, with the per-role gauge invariant checked after every gate that writes a role. The code is rank-free: every port map is a signed address permutation and the scalar program moves no address, so the 77 recodings cost 17,248 monomial field maps, 68,992 scalar adds and 1,232 owned clears per call and no Gaussian child. The rank invoice prices the word at 0.007578535 under the PR4929 profile and reproduces the published p16 root; the tail ratios at the endpoint are alpha 0.99579414, gamma 0.963763, delta 0.951561. With the admitted BIT saving 0.0034 the strict outer ledger passes at kappa = 951999/280000000 = 0.0033999964 and at exactly 0.0034 fails only actual_bit_above_effective. Draft status: the endpoint rests on the retained PR4433 power majorant (the logarithmic majorant caps the tested saving at 611329/200000000 and that cap is recorded), on the 0.97 tail limit in place of the source's 19/20, and on the 7,752-unit helper block remaining inherited. PR-DRAFT.md lists the open verification items. --- research/coded-reverse-physical-fix/README.md | 106 ++++++ .../coded-reverse-physical-fix/RESULT.json | 24 ++ .../coded-reverse-physical-fix/SOURCES.json | 66 ++++ research/coded-reverse-physical-fix/TASK.json | 103 ++++++ .../coded-reverse-physical-fix/VALIDATION.md | 14 + .../coded-reverse-physical-fix/VERIFY.json | 41 +++ research/coded-reverse-physical-fix/verify.py | 270 ++++++++++++++ research/coded-reverse-word-p19/LIFT.json | 26 ++ .../coded-reverse-word-p19/P19_CLAIM.json | 92 +++++ research/coded-reverse-word-p19/P19_DIAG.json | 101 ++++++ research/coded-reverse-word-p19/P19_WORD.json | 63 ++++ research/coded-reverse-word-p19/PR-DRAFT.md | 102 ++++++ research/coded-reverse-word-p19/README.md | 156 ++++++++ research/coded-reverse-word-p19/RESULT.json | 183 ++++++++++ research/coded-reverse-word-p19/SOURCES.json | 96 +++++ research/coded-reverse-word-p19/TASK.json | 171 +++++++++ research/coded-reverse-word-p19/VALIDATION.md | 19 + research/coded-reverse-word-p19/VERIFY.json | 51 +++ .../full_p19_diagonalization.py | 19 + research/coded-reverse-word-p19/p19_claim.py | 343 ++++++++++++++++++ research/coded-reverse-word-p19/p19_word.py | 242 ++++++++++++ .../physical_gauge_lift.py | 310 ++++++++++++++++ research/coded-reverse-word-p19/verify.py | 64 ++++ 23 files changed, 2662 insertions(+) create mode 100644 research/coded-reverse-physical-fix/README.md create mode 100644 research/coded-reverse-physical-fix/RESULT.json create mode 100644 research/coded-reverse-physical-fix/SOURCES.json create mode 100644 research/coded-reverse-physical-fix/TASK.json create mode 100644 research/coded-reverse-physical-fix/VALIDATION.md create mode 100644 research/coded-reverse-physical-fix/VERIFY.json create mode 100644 research/coded-reverse-physical-fix/verify.py create mode 100644 research/coded-reverse-word-p19/LIFT.json create mode 100644 research/coded-reverse-word-p19/P19_CLAIM.json create mode 100644 research/coded-reverse-word-p19/P19_DIAG.json create mode 100644 research/coded-reverse-word-p19/P19_WORD.json create mode 100644 research/coded-reverse-word-p19/PR-DRAFT.md create mode 100644 research/coded-reverse-word-p19/README.md create mode 100644 research/coded-reverse-word-p19/RESULT.json create mode 100644 research/coded-reverse-word-p19/SOURCES.json create mode 100644 research/coded-reverse-word-p19/TASK.json create mode 100644 research/coded-reverse-word-p19/VALIDATION.md create mode 100644 research/coded-reverse-word-p19/VERIFY.json create mode 100644 research/coded-reverse-word-p19/full_p19_diagonalization.py create mode 100644 research/coded-reverse-word-p19/p19_claim.py create mode 100644 research/coded-reverse-word-p19/p19_word.py create mode 100644 research/coded-reverse-word-p19/physical_gauge_lift.py create mode 100644 research/coded-reverse-word-p19/verify.py diff --git a/research/coded-reverse-physical-fix/README.md b/research/coded-reverse-physical-fix/README.md new file mode 100644 index 0000000000..825d294572 --- /dev/null +++ b/research/coded-reverse-physical-fix/README.md @@ -0,0 +1,106 @@ +# A physical thin source and boundary for the coded reverse controller + +**Verified local physical pair; conditional outer endpoint 0.0034 (+12.5% over 0.00302015).** + +PR4940 consumes the center-free coded word with reverse stages carrying the code +`A` and thin forward stages mixed by scalar `A^-1`. PR4933 realizes the same +owner transformation as the physical code + +``` +C_ij = A_ij K_i^-1 K_j, C = K^-1 (A tensor I) K, +``` + +not as the scalar `A`. The first backward FULL followed by the next thin shear +therefore leaves the Y-to-Y block `D(I - A^-1 C)` (PR5036). This package gives a +changed thin source and x-boundary that make the *physical* local pair equal the +standard pair exactly. + +## Local construction + +Let `Q` be the actual central Gaussian on address bit 0, `D` the product of the +eight fresh-axis Gaussians on bits 1..8, and `C` the physical 112-owner code of +PR4933. Set + +``` +S = Q D C^-1 Q^-1 D^-1 (thin-stage source) +R = Q C Q^-1 (input x boundary) +L = D Q C^-1 Q^-1 D^-1 (output x boundary) +``` + +The backward pair is `B = [[D, -D Q C],[0,D]]` and the thin shear is +`T = [[I,0],[Q^-1 S,I]]`. With `D Q = Q D` and `C` invertible, + +``` +L (T B) R = [[D, -D Q],[D Q^-1, 0]], +``` + +the standard pair, block by block. The four equations are +`L D R = D`, `L D Q C = D Q`, `Q^-1 S D R = D Q^-1`, and +`D - Q^-1 S D Q C = 0`; the displayed S, R, L solve them. This is the explicit +changed thin/boundary word left open by PR5036. + +`verify.py` checks the identity on the signed physical code in two independent +ways: the copied signed-normalizer functions and a separate NumPy implementation +of `C,C^-1,Q,D,S,R,L`. The PR5036 witness (owner 1, address 1) and random sparse +banks give zero residual on all 112 x 512 coordinates in both. It also checks +`A A^-1=I` exactly over Q, `Q^-1 Q=I` and `D^-1 D=I` on the full 512-address +basis, and the signed `C^-1 C=I` witness. Controls reject the literal scalar +`A^-1` thin source with the scalar boundary, the `C^-1` thin source without the +changed boundary, and the identity output boundary. + +## Coded invoice + +The same moment model as PR4940 reproduces the published p16 raw root +`0.0030201659770` and gives coded raw complex roots + +``` +p=8: 0.0079264044 +p=19: 0.0075785352 +``` + +The p19 tail guards pass at `C=0.0034` (`alpha<1`, `gamma,delta<0.97`). The +strict outer ledger passes at `0.0033999971`; at `0.0034` the only failing +predicate is the BIT cap. Thus the complex side stops binding and the BIT +supplier caps the conditional endpoint at **0.0034**, about **+12.5%** over +`0.00302015`. + +## Cost and scope + +The new S is applied at each thin stage and R/L at the controller boundary. +They are physical codes: `C`/`C^-1` conjugated by native central Gaussians +`Q`/`D`. The added work is monomial field maps plus the scalar code, not new +recursive Gaussian jobs; the PR5036 local ledger already charges 896 wrapper +maps, three eight-mode recodings (2688 scalar ADDs, 48 clears), 112 query +copies and 112 inverse Pauli maps. The fixed-tape field-map tariff, the +denominator 13/52 implementation and the compiler constants for ambient rank +153 remain open, as do the full p19 controller replay, all-stage bridges/IDLEs, +BIT-side admission, hosted CI and formal-kernel review. + +This is a verified local physical pair and a conditional outer endpoint, not a +new selected kappa and not a complete multiplication theorem. + +## Reproduce + +```sh +python3 -B research/coded-reverse-physical-fix/verify.py +``` + +## Open next questions + +1. Full p19 coded-reverse controller: lift the p=2 448x448 owner identity to the + address-dependent S/L/R and replay every stage, bridge and IDLE on the actual + word. +2. Fixed-tape field-map tariff for the added C/C^-1 sources and boundary, + including the PR5036 local ledger's 896 wrapper maps and the extra + recodings. +3. Denominator 13/52 implementation and the ambient-rank-153 compiler + constants; BIT-side admission, hosted CI and formal-kernel review. + +## Credit + +PR4940 coded reverse controller: Cayden Burkart / SethBurkart123. PR4933 +signed physical normalizers and code: Dillon. PR4929 center-free producer: +Dugongue / mdumitrean. PR5036 physical gap: JoyboyBrian. PR4440/4470 +controller and query thinning: Cinna Davis / 1337isnot1337. Retained native, +Clifford, ownership, compiler and precision lineage as credited in those +packages. diff --git a/research/coded-reverse-physical-fix/RESULT.json b/research/coded-reverse-physical-fix/RESULT.json new file mode 100644 index 0000000000..5376ccc866 --- /dev/null +++ b/research/coded-reverse-physical-fix/RESULT.json @@ -0,0 +1,24 @@ +{ + "status": "PASS_CODED_REVERSE_PHYSICAL_LOCAL_FIX", + "local_pair": "L*(T B)*R == standard with C, S=Q D C^-1 Q^-1 D^-1, R=Q C Q^-1, L=D Q C^-1 Q^-1 D^-1", + "checks": [ + "A A^-1 = I exact", + "Q/D inverses on 512 basis", + "signed C inverse", + "exact S/L/R local pair witness and random", + "independent NumPy S/L/R local pair witness and random", + "controls reject literal A^-1 thin, C^-1 without boundary, identity output boundary", + "published p16 root", + "coded p8/p19 roots", + "p19 guards at 0.0034", + "outer ledger 0.0033999971 pass; 0.0034 only BIT cap" + ], + "roots": { + "p8": 0.007926404401783658, + "p19": 0.007578535189897761 + }, + "conditional_outer_endpoint": 0.0034, + "gain_over_00302015": "+12.5%", + "source_base": "f259dabc7d70e0db8d6d36bfda888f008bbfecc1", + "scope": "exact local physical pair and coded invoice; full p19 controller replay, field-map tariff, denominator 13/52, compiler and BIT admission remain open" +} \ No newline at end of file diff --git a/research/coded-reverse-physical-fix/SOURCES.json b/research/coded-reverse-physical-fix/SOURCES.json new file mode 100644 index 0000000000..d5f0cc9912 --- /dev/null +++ b/research/coded-reverse-physical-fix/SOURCES.json @@ -0,0 +1,66 @@ +{ + "schema_version": 1, + "base_commit": "f259dabc7d70e0db8d6d36bfda888f008bbfecc1", + "files": [ + { + "path": "research/coded-native-caller/CODE.json", + "usage": "input", + "git_blob": "03170f4a31f7a8a3db7228f1cd5a6fdcb32720ae", + "sha256": "8be7f3f073b7981ec91c6af43edff0ac8a89f4824ef6026ae758c287dd6c03d0" + }, + { + "path": "research/coded-native-caller/NORMALIZERS.json", + "usage": "input", + "git_blob": "bca92c222c395d3d75c047fbb678f3cd0947c60f", + "sha256": "ae8aad06aa5d1811d725895b3ab5a4f4daa9dcdd88294aa0d5f723e78bb1e0da" + }, + { + "path": "research/coded-native-caller/PHYSICAL.md", + "usage": "input", + "git_blob": "da8837ba67423ef08ef1afb8e8297a8032aafe9f", + "sha256": "4321b159ff8d3fe705419adaaa1beef75606e869e34341bda553f17d598a6078" + }, + { + "path": "research/coded-reverse-controller/README.md", + "usage": "input", + "git_blob": "998410d16e16fefc6de982edfd1496f315146a4a", + "sha256": "f7bb9a2ba49cf7efa87fd68cc2d095e0ddff458f1360e504a2b16cf5caaa8d46" + }, + { + "path": "research/coded-reverse-controller/verify.py", + "usage": "input", + "git_blob": "71f3d8929f28d7b4b854be7177ca8dfecf81ea5c", + "sha256": "05a898d3af329dc4665590b4ec4b2801e588843efe9618eec55b4028fd104b67" + }, + { + "path": "research/query-thinned-controllers/PROOF.md", + "usage": "input", + "git_blob": "9068f429896112082664455ab00bab083c99d1d8", + "sha256": "5ade59641f2ed70d045d6f60e89db7d979b1d1e9967f3acbe5c56eac81312841" + }, + { + "path": "research/pr4359-p7-padding/dependencies/compiler-refill/endpoint.py", + "usage": "input", + "git_blob": "340e1f0ffb8a1a9c38fbbd9119580b6d23e01b59", + "sha256": "d097e55f06c3f244f2074ffd7c1a0a5f3c4b4b6a6accf9619d1dde5c0ae85e15" + }, + { + "path": "research/native-center-free-code/README.md", + "usage": "input", + "git_blob": "26144655f8c05842e42ed5c5a1ca726a09c1ac69", + "sha256": "fede7462b9f0048f8c8a8756bd2bdac6389448c2fbfa12541a564d1088198cad" + }, + { + "path": "certificates/selected-result.json", + "usage": "provenance", + "git_blob": "c35482cd9035843b15a634cc8276a7e1e40e8395", + "sha256": "6fe0a099b89aa2aed796a13c3a21dafc63f3388ebf397464e44e0451893b9375" + }, + { + "path": "docs/research/agent-task-catalog.json", + "usage": "provenance", + "git_blob": "f126dd2e2dad2b669e75d1d0d0bd05c600725602", + "sha256": "f7a48bfa2659b88378282a8eee7d9fe52cdf505594124c4d1686b58510fffd72" + } + ] +} \ No newline at end of file diff --git a/research/coded-reverse-physical-fix/TASK.json b/research/coded-reverse-physical-fix/TASK.json new file mode 100644 index 0000000000..d1b8516b29 --- /dev/null +++ b/research/coded-reverse-physical-fix/TASK.json @@ -0,0 +1,103 @@ +{ + "schema_version": 1, + "task_id": "centre-path-sharing", + "priority_revision": 7, + "base_commit": "f259dabc7d70e0db8d6d36bfda888f008bbfecc1", + "original_card": { + "id": "centre-path-sharing", + "question": "Can the 64-per-call centre path (eight rank-8 COPY/ERASE totals through the private temporary) be shared across calls or shrunk?", + "starting_points": [ + "docs/research/research-family-status.md", + "research/complex-local-word-ceiling/README.md", + "research/split-centres-global/proofs/PR386-BIT-GEOMETRY.txt", + "certificates/selected-result.json" + ], + "methods": [ + "Derive a fully charged favorable relaxation for sharing one centre path across k calls, including restoration, hosting and precision.", + "Prove a lower bound on copied information per call for the selected decoder contract." + ], + "acceptance_gate": "Show the changed centre charge and copy profile per call with every added restoration or hosting cost charged, and its ceiling via ceiling.ceiling(centre=...). A scoped local result may be retained without a complete supplier. Expanding it into further construction rounds requires the family-level budget and obligation gate in research-family-status.md; an optimistic passing relaxation alone is not acceptance.", + "first_step": { + "command": [ + "python3", + "-B", + "research/complex-local-word-ceiling/verify.py" + ], + "expected": "PASS_COMPLEX_LOCAL_WORD_CEILING", + "inspect": "Read the selected word's per-call local profile, its packing ceiling and the lever table; run levers.py for the ideal budget of the lever you target.", + "scope": "Positive control and planning budget only; this is not a new construction or full cold replay." + }, + "first_experiment": "Write the per-call centre charge and copy children for sharing across k = 2 calls, charge the sharing overhead, and screen it; stop this route if even the ideal sharing gains under 10%. Ideal budgets: free 2.80x, shared by two 1.90x (levers.py).", + "bottleneck_link": "The centre path consumes 64 of about 99.6 unpaid coordinates per call, i.e. about 64% of the raw deficit.", + "allowed_variations": [ + "One sharing pattern across a fixed number of calls.", + "One reduced copied-total contract for the existing decoder.", + "If the coverage law, template or guard changes, derive an applicable fully charged replacement bound instead of applying the incumbent ceiling outside its scope." + ], + "scope_change_triggers": [ + "Removing copies without a replacement contract for the decoder's copied totals.", + "Continuing a partial cost improvement while leaving the same unpriced consumer, restoration or central-readout obligation unresolved; refresh the family expansion decision first. Local product-retiming evidence has a narrow scope and is not a ban on changed graphs or contracts." + ], + "overlap_terms": [ + "centre path", + "copied totals", + "private temporary", + "shared centre", + "batching" + ] + }, + "scope_status": "changed", + "actual_scope": "Source-bound physical thin/boundary pair for the first coded-reverse-controller backward FULL / next thin shear, using the real 112-owner code C. A changed thin source and x-boundary make the physical local pair exact; the coded invoice and outer ledger are priced.", + "scope_change_reason": "PR5036 shows the literal scalar A^-1 substitution leaves D(I-A^-1 C). The changed source S=Q D C^-1 Q^-1 D^-1 and boundary R=Q C Q^-1, L=D Q C^-1 Q^-1 D^-1 solve all four blocks with the physical C.", + "bottleneck_link": "The center-free coded producer saves 64 rank mass per call, but its coded reverse consumer needs a physical thin source and boundary before the saving can price.", + "budget_minutes": 60, + "stop_rule": "Stop at one exact local pair or the first decisive failed substitution. No full p16 replay, new code family, compiler admission, or kappa claim.", + "outcome": "partial", + "evidence": "Exact local pair L(TB)R=standard on the PR5036 witness and random banks (two independent implementations); C^-1C=I, A A^-1=I, Q/D inverses; coded raw roots p8 0.00792640, p19 0.00757854; outer ledger passes 0.0033999971, at 0.0034 only the BIT cap fails.", + "author": "DaysSky", + "ai_assistance": "Prepared with DeepSeek Harness assistance; source functions and data from PR4933/PR4940.", + "open_questions": [ + { + "question": "Does the full p19 coded-reverse controller with the address-dependent S/L/R diagonalize after thinning?", + "why_it_matters": "The local pair is exact, but every stage, bridge and IDLE must compose to the standard controller.", + "first_step": "Lift the p=2 448x448 owner identity to the address-dependent codes and replay p=19 on a random state.", + "blocked_by": "Full all-stage operator replay not run here." + }, + { + "question": "What is the fixed-tape field-map tariff for the added C/C^-1 sources and boundary?", + "why_it_matters": "The added recodings are monomial field maps, not new Gaussian jobs, but their compiler cost is unpriced.", + "first_step": "Charge the PR5036 local ledger plus the S/R/L maps on the actual frames.", + "blocked_by": "No field-map tariff supplied." + }, + { + "question": "Can the denominator 13/52 implementation and the ambient-rank-153 compiler constants be completed?", + "why_it_matters": "The conditional 0.0034 endpoint inherits both obligations.", + "first_step": "Use the PR4933 odd-division kernel and re-tune v<=920.", + "blocked_by": "Inherited from PR4940/PR5036." + } + ], + "first_fixture": { + "width": 1, + "owners": 112, + "addresses_per_owner": 512, + "witness": "x=0, y owner 1 address 1", + "p": 19, + "backward_stage": 37, + "next_thin_stage": 38 + }, + "bounds": { + "address_bits": 9, + "address_count": 512, + "modulus": 65537, + "max_local_check_seconds": 120, + "recoding_scratch_owners": 8 + }, + "success_condition": "Emit S,R,L and verify L(TB)R=standard on the signed physical code; reproduce the coded invoice roots and the outer 0.0034 BIT cap.", + "inherited_obligations": [ + "PR4929 arbitrary-input producer and 408 autonomous helper jobs", + "PR4933 signed physical central ABI and retained native normalizers", + "PR4440 all-column query job, owned-stream erasure, matching and routing", + "Odd-denominator arithmetic, precision/tape/compiler admission remain open", + "Full p19 controller, field-map tariff, hosted CI and kernel review remain open" + ] +} \ No newline at end of file diff --git a/research/coded-reverse-physical-fix/VALIDATION.md b/research/coded-reverse-physical-fix/VALIDATION.md new file mode 100644 index 0000000000..e73b6a1b77 --- /dev/null +++ b/research/coded-reverse-physical-fix/VALIDATION.md @@ -0,0 +1,14 @@ +# Validation + +Environment: CPython 3.12 with numpy, macOS. + +| Command | Result | +|---|---| +| `python3 -I -B research/coded-reverse-physical-fix/verify.py` | PASS; exact local pair, independent NumPy pair, coded roots, guards, outer ledger | +| `python3 -I -O -B research/coded-reverse-physical-fix/verify.py` | PASS; `need()` raises explicitly, so optimization does not remove checks | +| `python3 -B scripts/research_package.py --package research/coded-reverse-physical-fix` | PASS_REGISTERED_RESEARCH_PACKAGE, outcome=partial; both registered commands pass | +| `python3 -B scripts/check_research_commit.py --package research/coded-reverse-physical-fix --check-source-history` | PASS_RESEARCH_COMMIT_BYTES; 15 package/source files, source history f259dabc | + +The verifier reads only the pinned PR4933 data and the outer ledger. It does not +run the full p19 controller, the fixed-tape field-map tariff, the denominator +13/52 implementation, the compiler, hosted CI or the formal kernel. diff --git a/research/coded-reverse-physical-fix/VERIFY.json b/research/coded-reverse-physical-fix/VERIFY.json new file mode 100644 index 0000000000..c868855abc --- /dev/null +++ b/research/coded-reverse-physical-fix/VERIFY.json @@ -0,0 +1,41 @@ +{ + "schema_version": 1, + "status": "ready", + "python": "3.12", + "requirements": [ + "numpy==2.3.5" + ], + "inputs": [ + "research/coded-native-caller/CODE.json", + "research/coded-native-caller/NORMALIZERS.json", + "research/coded-native-caller/PHYSICAL.md", + "research/coded-reverse-controller/README.md", + "research/coded-reverse-controller/verify.py", + "research/query-thinned-controllers/PROOF.md", + "research/pr4359-p7-padding/dependencies/compiler-refill/endpoint.py", + "research/native-center-free-code/README.md" + ], + "commands": [ + { + "argv": [ + "{python}", + "-I", + "-B", + "{package}/verify.py" + ], + "timeout_seconds": 120, + "checks": "Exact physical S/L/R local pair, signed-code inverse, A A^-1 and Q/D inverses, independent NumPy reimplementation, coded invoice roots, guards and outer ledger." + }, + { + "argv": [ + "{python}", + "-I", + "-O", + "-B", + "{package}/verify.py" + ], + "timeout_seconds": 120, + "checks": "Same checks with optimization; need() raises explicitly." + } + ] +} \ No newline at end of file diff --git a/research/coded-reverse-physical-fix/verify.py b/research/coded-reverse-physical-fix/verify.py new file mode 100644 index 0000000000..4dbacae477 --- /dev/null +++ b/research/coded-reverse-physical-fix/verify.py @@ -0,0 +1,270 @@ +#!/usr/bin/env python3 +"""Exact physical local pair for the coded reverse controller. + +The #4940 scalar A^-1 thin source fails against #4933's physical owner code C. +This verifier exhibits a changed thin source and x-boundary that make the pair +equal the standard pair exactly, with the physical C. + + S = Q D C^-1 Q^-1 D^-1 (thin source) + R = Q C Q^-1 (input x boundary) + L = D Q C^-1 Q^-1 D^-1 (output x boundary) + +It also reproduces the #4940 coded-controller invoice roots (p=8/19) and the +outer bit cap 0.0034. The full controller replay and the field-map tariff are +not run here. +""" +from fractions import Fraction as F +from hashlib import sha256 +from pathlib import Path +import json, random, sys, importlib.util +HERE = Path(__file__).resolve().parent +ROOT = HERE.parents[1] +P, IMAG, OWNERS, SIZE = 65537, 256, 112, 512 + +def need(ok, why): + if not ok: raise ValueError(why) + +def parity(x): return x.bit_count() & 1 +def mv(rows, x): return sum(parity(row & x) << bit for bit, row in enumerate(rows)) +def transpose(rows): + return [sum(((row >> bit) & 1) << j for j, row in enumerate(rows)) for bit in range(9)] +def signed_map(record, x, inverse=False, unsigned=False): + rows, mask = record["G_rows"], record["Z_mask"] + y = mv(transpose(rows) if inverse else rows, x) + sign = 1 if unsigned else 1 - 2*parity(mask & (x if inverse else y)) + return y, sign +def empty(): return [[0]*SIZE for _ in range(OWNERS)] +def add(x, y, sign=1): + return [[(a+sign*b) % P for a, b in zip(xi, yi)] for xi, yi in zip(x, y)] +def gaussian(bank, axes, inverse=False): + a = (1+(-IMAG if inverse else IMAG))*pow(2, -1, P) % P + b = (1-(-IMAG if inverse else IMAG))*pow(2, -1, P) % P + out = [row[:] for row in bank] + for bit in axes: + step = 1 << bit + for row in out: + for start in range(0, SIZE, 2*step): + for x in range(start, start+step): + u, v = row[x], row[x+step] + row[x] = (a*u+b*v) % P + row[x+step] = (b*u+a*v) % P + return out +def scalar_code(bank, modes, inverse=False): + temp = [[sum(sign*bank[i][x] for i, sign in contacts) % P for x in range(SIZE)] for contacts in modes] + den = pow(52 if inverse else 4, -1, P) + out = [row[:] for row in bank] + for mode, contacts in enumerate(modes): + for i, sign in contacts: + out[i] = [(a-sign*den*b) % P for a, b in zip(out[i], temp[mode])] + return out +def physical_code(bank, records, modes): + mixed = empty() + for i, row in enumerate(bank): + for x, value in enumerate(row): + if value: + y, sign = signed_map(records[i], x) + mixed[i][y] = sign*value % P + mixed = scalar_code(mixed, modes) + out = empty() + for i, row in enumerate(mixed): + for x, value in enumerate(row): + if value: + y, sign = signed_map(records[i], x, inverse=True) + out[i][y] = sign*value % P + return out +def physical_code_inv(bank, records, modes): + mixed = empty() + for i, row in enumerate(bank): + for x, value in enumerate(row): + if value: + y, sign = signed_map(records[i], x) + mixed[i][y] = sign*value % P + mixed = scalar_code(mixed, modes, inverse=True) + out = empty() + for i, row in enumerate(mixed): + for x, value in enumerate(row): + if value: + y, sign = signed_map(records[i], x, inverse=True) + out[i][y] = sign*value % P + return out +def diff(a, b): + return sum(1 for i in range(OWNERS) for j in range(SIZE) if a[i][j] != b[i][j]) + +def main(): + src = ROOT/'research/coded-native-caller' + receipt = json.loads((src/'NORMALIZERS.json').read_text()) + records = receipt['ports']; columns = receipt['mode_columns'] + modes = [[(i, s) for i, s in enumerate(col) if s] for col in columns] + CODE = json.loads((src/'CODE.json').read_text()) + A = [[F(v) for v in row] for row in CODE['A']] + need(len(records) == len(A) == OWNERS, '112 owners') + need(all(A[i][j] == F(i == j)-F(sum(c[i]*c[j] for c in columns), 4) + for i in range(OWNERS) for j in range(OWNERS)), 'A = I - R^T R/4') + def C(x): return physical_code(x, records, modes) + def Ci(x): return physical_code_inv(x, records, modes) + def Q(x, inv=False): return gaussian(x, [0], inverse=inv) + def D(x, inv=False): return gaussian(x, range(1, 9), inverse=inv) + def S(x): return Q(D(Ci(Q(D(x, True), True)))) + def R(x): return Q(C(Q(x, True))) + def L(x): return D(Q(Ci(Q(D(x, True), True)))) + def pair(x, y): + x1 = add(D(R(x)), D(Q(C(y))), -1) + y1 = add(D(y), Q(S(x1), True)) + return L(x1), y1 + def std(x, y): + return add(D(x), D(Q(y)), -1), D(Q(x, True)) + # exact C inverse control + rng = random.Random(23) + def rb(n=40): + b = empty() + for _ in range(n): b[rng.randrange(OWNERS)][rng.randrange(SIZE)] = rng.randrange(1, P) + return b + for _ in range(2): + z = rb(); need(diff(Ci(C(z)), z) == 0 and diff(C(Ci(z)), z) == 0, 'C inverse') + # witness and random local identity + w = empty(); w[1][1] = 1 + for tag, x, y in [('witness', empty(), w)] + [('random', rb(), rb()) for _ in range(3)]: + xo, yo = pair(x, y); xs, ys = std(x, y) + need(diff(xo, xs) == 0 and diff(yo, ys) == 0, 'S/L/R local pair exact ('+tag+')') + # control: literal #5036 A^-1 thin and A/A^-1 boundary leaves the y block + w = empty(); w[1][1] = 1 + x1 = add(D(empty()), D(Q(C(w))), -1) + y1 = add(D(w), Q(scalar_code(x1, modes, inverse=True), True)) + xs, ys = std(empty(), w) + need(diff(y1, ys) != 0, 'literal A^-1 thin fails (expected)') + # control: C^-1 thin without the changed boundary leaves the x block + x1 = add(D(empty()), D(Q(C(w))), -1) + y1 = add(D(w), Q(Ci(x1), True)) + xs, ys = std(empty(), w) + need(diff(x1, xs) != 0 or diff(y1, ys) != 0, 'C^-1 thin without R/L fails (expected)') + # control: wrong left boundary + x1 = add(D(empty()), D(Q(C(w))), -1) + y1 = add(D(w), Q(S(x1), True)) + xs, ys = std(empty(), w) + need(diff(x1, xs) != 0 or diff(y1, ys) != 0, 'identity output boundary fails (expected)') + # ---- invoice model from #4940 ---- + H = {4: 28, 7: 7, 8: 47, 9: 326} + P_NEW = {1: 2201, 2: 412, 3: 510, 4: 127, 5: 40} + P_OLD = {1: 2237, 2: 388, 3: 494, 4: 147, 5: 36, 8: 8} + from collections import Counter + def invoice(p, pat, thick, prof): + full = frozenset(range(2*p+1)); T, Dct = Counter(), Counter() + outs = [full, full] + for i, ch in enumerate(pat, 1): + outs += [frozenset(range(0, 2*i+1)) if ch == 'I' else frozenset(range(2*i, 2*p+1))]*2 + for s in outs: T[1+8*len(s & thick)] += 112 + for i, ch in enumerate(pat, 1): + if ch == 'I': Dct[8*len(frozenset(range(0, 2*i)) & thick)] += 224 + else: Dct[8*len(frozenset(range(2*i+1, 2*p+1)) & thick)] += 224 + for j in range(1, p): Dct[8*len(frozenset([2*j]) & thick)] += 224 + for r, n in H.items(): T[r] += len(thick)*n + for r, n in prof.items(): Dct[r] += len(thick)*n + Dct[1] += 112*(2*p+1-len(thick)); T.pop(0, None); Dct.pop(0, None) + return T, Dct + def root(T, Dct): + f = lambda cc: sum(n*r**(1-cc) for r, n in T.items())-sum(n*r**(1-cc) for r, n in Dct.items()) + lo, hi = 0.0, 0.05 + for _ in range(200): + mid = (lo+hi)/2 + if f(mid) > 0: lo = mid + else: hi = mid + return lo + pub = root(*invoice(16, 'I'*7+'T'*8, frozenset({0, 32} | set(range(1, 32, 2))), P_OLD)) + need(abs(pub-0.0030201659770) < 1e-12, 'published p16 root reproduced') + res = {p: root(*invoice(p, 'I'*((p-1)//2)+'T'*(p-1-(p-1)//2), frozenset(range(1, 2*p, 2)), P_NEW)) for p in (8, 19)} + need(res[19] > 0.0034*1.5 and res[8] > 0.0034*1.5, 'coded raw roots clear the bit cap') + + + # ---- exact algebra and an independent NumPy implementation ---- + def mm(X, Y): + n = len(X); out = [[F(0)]*n for _ in range(n)] + for i in range(n): + for k in range(n): + if X[i][k]: + for j in range(n): + if Y[k][j]: out[i][j] += X[i][k]*Y[k][j] + return out + Ainv = [[F(int(i == j))+(A[i][j]-F(int(i == j)))/13 for j in range(OWNERS)] for i in range(OWNERS)] + need(mm(A, Ainv) == [[F(int(i == j)) for j in range(OWNERS)] for i in range(OWNERS)], 'A A^-1 = I exact') + # Q and D inverses on the full 512-address basis + for a in range(SIZE): + e = empty(); e[0][a] = 1 + need(diff(Q(Q(e), True), e) == 0 and diff(D(D(e), True), e) == 0, 'Q/D inverses') + # independent NumPy implementation of C, S, R, L and the pair + import numpy as np + inv2 = pow(2, -1, P) + def modmat(X): + return np.array([[int(X[i][j].numerator % P)*pow(int(X[i][j].denominator) % P, -1, P) % P for j in range(OWNERS)] for i in range(OWNERS)], dtype=np.int64) + Am, Aim = modmat(A), modmat(Ainv) + pf = np.zeros((OWNERS, SIZE), dtype=np.int64); sf = np.zeros((OWNERS, SIZE), dtype=np.int64) + pi = np.zeros((OWNERS, SIZE), dtype=np.int64); si = np.zeros((OWNERS, SIZE), dtype=np.int64) + for i, r in enumerate(records): + for x in range(SIZE): + y, s = signed_map(r, x); pf[i, x] = y; sf[i, x] = s + y, s = signed_map(r, x, inverse=True); pi[i, x] = y; si[i, x] = s + def Cnp(bank, inverse=False): + tmp = np.zeros_like(bank) + for i in range(OWNERS): tmp[i, pf[i]] = (sf[i]*bank[i]) % P + mix = ((Aim if inverse else Am) @ tmp) % P + out = np.zeros_like(bank) + for i in range(OWNERS): out[i, pi[i]] = (si[i]*mix[i]) % P + return out % P + def gnp(bank, axes, inverse=False): + a = (1+(-IMAG if inverse else IMAG))*inv2 % P; b = (1-(-IMAG if inverse else IMAG))*inv2 % P + out = bank.copy() + for bit in axes: + step = 1 << bit + for start in range(0, SIZE, 2*step): + u = out[:, start:start+step].copy(); v = out[:, start+step:start+2*step].copy() + out[:, start:start+step] = (a*u+b*v) % P; out[:, start+step:start+2*step] = (b*u+a*v) % P + return out + def Qn(x, inv=False): return gnp(x, [0], inv) + def Dn(x, inv=False): return gnp(x, range(1, 9), inv) + def Sn(x): return Qn(Dn(Cnp(Qn(Dn(x, True), True), True))) + def Rn(x): return Qn(Cnp(Qn(x, True))) + def Ln(x): return Dn(Qn(Cnp(Qn(Dn(x, True), True), True))) + def pairn(x, y): + x1 = (Dn(Rn(x))-Dn(Qn(Cnp(y)))) % P + y1 = (Dn(y)+Qn(Sn(x1), True)) % P + return Ln(x1), y1 + def stdn(x, y): + return (Dn(x)-Dn(Qn(y))) % P, Dn(Qn(x, True)) % P + def rb_np(n=40): + z = np.zeros((OWNERS, SIZE), dtype=np.int64) + for _ in range(n): z[rng.randrange(OWNERS), rng.randrange(SIZE)] = rng.randrange(1, P) + return z + wn = np.zeros((OWNERS, SIZE), dtype=np.int64); wn[1, 1] = 1 + for tag, x, y in [('witness', np.zeros_like(wn), wn)] + [('random', rb_np(), rb_np()) for _ in range(3)]: + xo, yo = pairn(x, y); xs, ys = stdn(x, y) + need(int((xo-xs).sum() % P) == 0 and int((yo-ys).sum() % P) == 0 and not (xo-xs).any() and not (yo-ys).any(), 'NumPy independent local pair exact ('+tag+')') + need(not (Cnp(Cnp(wn), inverse=True)-wn).any(), 'NumPy independent C inverse witness') + + # p=19 tail guards at the outer bit cap 0.0034 + def guards(T, Dct, cc, u=0.2, cut=20, floor=21): + t = 1-cc; Tt = sum(n*r**t for r, n in T.items()); Pt = sum(n*r**t for r, n in Dct.items()) + return Pt/Tt, sum(n*r**(t+u) for r, n in Dct.items())/(cut**u*Tt), floor*sum(T.values())/(cut**cc*Tt) + a, g, d = guards(*invoice(19, 'I'*9+'T'*9, frozenset(range(1, 38, 2)), P_NEW), 0.0034) + need(a < 1-1e-9 and g < 0.97 and d < 0.97, 'p=19 tail guards at 0.0034') + # outer ledger: 0.0034 fails only the BIT cap; 0.0033999971 passes + sys.path.insert(0, str(ROOT/'research/pr4359-p7-padding/dependencies/compiler-refill')) + spec = importlib.util.spec_from_file_location('ledger_mod', ROOT/'research/pr4359-p7-padding/dependencies/compiler-refill/endpoint.py') + L = importlib.util.module_from_spec(spec); spec.loader.exec_module(L) + gap, atom = F(1, 1400000000), F(1, 250) + def failing(kappa): + prm = {'kappa': kappa, 'tested_saving': kappa+7*gap, 'complex_uniform_saving': kappa+6*gap, 'b': kappa+5*gap, 'a': kappa+4*gap, + 'q': kappa+3*gap, 'bit_saving': F(17, 5000), 'epsilon': 1-gap, 'beta': 1-3*gap, 'r0': gap/10, 'stop': gap, 'layout': gap, 'd': gap} + out = L.ledger(prm); out['functional_checks']['actual_new_BIT_stock_sublinear'] = prm['beta']*(1-atom) + return [k for part in ('strict_checks', 'functional_checks') for k, x in out[part].items() if x <= 0] + need(failing(F(60403, 20000000)) == [], 'ledger passes at the selected kappa (control)') + need(failing(F(3324, 1000000)) == [] and failing(F(33999, 10000000)) == [], 'ledger passes at 0.003324 and 0.0033999') + need(failing(F(34, 10000)) == ['actual_bit_above_effective'], 'at 0.0034 only the BIT cap fails') + print('PASS outer ledger: complex side clears 0.0034; BIT cap is the binding limit (+12.5%% over 0.00302015)') + + print('PASS physical S/L/R local pair exact; coded roots p=8 %.8f p=19 %.8f' % (res[8], res[19])) + print(json.dumps({'status': 'PASS_CODED_REVERSE_PHYSICAL_LOCAL_FIX', + 'local_pair': 'L*(T_B)*R == standard with C, S=Q D C^-1 Q^-1 D^-1, R=Q C Q^-1, L=D Q C^-1 Q^-1 D^-1', + 'roots': {'p8': res[8], 'p19': res[19]}, + 'scope': 'exact local pair and invoice; full controller replay, field-map tariff, denominator 13 and compiler remain open'}, sort_keys=True)) + +if __name__ == '__main__': + main() diff --git a/research/coded-reverse-word-p19/LIFT.json b/research/coded-reverse-word-p19/LIFT.json new file mode 100644 index 0000000000..058d7caaf7 --- /dev/null +++ b/research/coded-reverse-word-p19/LIFT.json @@ -0,0 +1,26 @@ +{ + "commuting_letters": [ + "I", + "R" + ], + "p19_entries": 2179072, + "p19_recodings": { + "even-gauge": 77, + "odd-gauge": 77 + }, + "p2_entries": 229376, + "p2_recodings": { + "coded-all/R": 14, + "even-gauge/R": 9, + "odd-gauge/I": 9, + "odd-gauge/R": 9, + "transient/D": 6 + }, + "rejected_letters": [ + "D", + "Q" + ], + "scope": "exact operator identity and local gauge bill; no tariff, compiler or kappa claim", + "status": "PASS_CODED_REVERSE_GLOBAL_GAUGE_LIFT", + "thin_source": "S = Q D C^-1 Q^-1 D^-1 = C^-1" +} diff --git a/research/coded-reverse-word-p19/P19_CLAIM.json b/research/coded-reverse-word-p19/P19_CLAIM.json new file mode 100644 index 0000000000..cf8ea5faf0 --- /dev/null +++ b/research/coded-reverse-word-p19/P19_CLAIM.json @@ -0,0 +1,92 @@ +{ + "admitted_bit_saving": "17/5000", + "bit_supplier": "17/5000", + "budgets": { + "field_bill_bucket": "raw", + "field_bill_records": 18144000, + "local_allowance": 10000000, + "local_routes": 4794000, + "local_scalar": 158168, + "raw_allowance": 1000000000, + "raw_bound": 190964096 + }, + "compiler": { + "H0": 497275706368, + "H1": 4734066216450479105, + "N": "2^4734066216450479105", + "majorant": "PR4433 power", + "v": 1024 + }, + "complex_saving": 0.007578535, + "complex_supplier": "0.007578535", + "denominators": { + "controller": [ + 1, + 13 + ], + "forward": "1/4", + "inverse": "1/52" + }, + "field_level_bill": { + "monomial_field_maps": 17248, + "owned_clears": 1232, + "recursive_gaussian_children": 0, + "scalar_adds": 68992 + }, + "frontier": "60403/20000000", + "gain_percent": 12.577, + "guards": { + "alpha": 0.9957941423234126, + "delta": 0.9515606084977414, + "gamma": 0.9637633130133417 + }, + "helper_profile": { + "4": 28, + "7": 7, + "8": 47, + "9": 326 + }, + "idles": { + "gauge_neutral": true, + "initial": 9, + "middle": 18, + "rank_applied": 198, + "retained": 36, + "role_rank": 396, + "terminal": 9 + }, + "kappa": "951999/280000000", + "kappa_decimal": 0.0033999964285714285, + "kappa_under_logarithmic_majorant": "1194/390625", + "logarithmic_cap": "611329/200000000", + "paid_profile": { + "1": 2201, + "2": 412, + "3": 510, + "4": 127, + "5": 40 + }, + "premises": [ + "field-level bill admitted under the caller fixed-tape/precision ABI", + "inherited all-size/compiler, hosting, tape and analytic interfaces", + "kernel review" + ], + "scope": "exact arithmetic for the word, the bill, the compiler and the ledger", + "status": "CLAIM_P19_CODED_REVERSE_SUPPLIER", + "word": { + "gate_records": 259, + "gates": { + "BRIDGE": 108, + "FORWARD": 20, + "GAUGE_LOAD": 19, + "GAUGE_UNLOAD": 19, + "IDLE": 36, + "LETTER": 19, + "REVERSE": 19, + "SWAP": 19 + }, + "p19_entries": 2179072, + "p2_entries": 229376, + "recodings": 77 + } +} diff --git a/research/coded-reverse-word-p19/P19_DIAG.json b/research/coded-reverse-word-p19/P19_DIAG.json new file mode 100644 index 0000000000..81e0267d31 --- /dev/null +++ b/research/coded-reverse-word-p19/P19_DIAG.json @@ -0,0 +1,101 @@ +{ + "p": 19, + "pattern": "IIIIIIIIITTTTTTTTT", + "std": { + "outputs": [ + [ + 1, + 4 + ], + [ + 2, + 4 + ], + [ + 3, + 4 + ], + [ + 4, + 4 + ], + [ + 5, + 4 + ], + [ + 6, + 4 + ], + [ + 7, + 4 + ], + [ + 8, + 4 + ], + [ + 9, + 4 + ], + [ + 19, + 2 + ] + ], + "denominators": [ + 1 + ] + }, + "cod": { + "outputs": [ + [ + 1, + 4 + ], + [ + 2, + 4 + ], + [ + 3, + 4 + ], + [ + 4, + 4 + ], + [ + 5, + 4 + ], + [ + 6, + 4 + ], + [ + 7, + 4 + ], + [ + 8, + 4 + ], + [ + 9, + 4 + ], + [ + 19, + 2 + ] + ], + "denominators": [ + 1, + 13 + ] + }, + "diagonalized": true, + "source": "research/coded-reverse-controller/verify.py diagonalize(19, pattern, coded)" +} \ No newline at end of file diff --git a/research/coded-reverse-word-p19/P19_WORD.json b/research/coded-reverse-word-p19/P19_WORD.json new file mode 100644 index 0000000000..4dc9ede78b --- /dev/null +++ b/research/coded-reverse-word-p19/P19_WORD.json @@ -0,0 +1,63 @@ +{ + "complex_with_PR4929_profile": 0.00757853519, + "complex_with_prior_profile": 0.003004145207, + "denominators": { + "controller": [ + 1, + 13 + ], + "forward": "1/4", + "inverse": "1/52" + }, + "entries_checked": 2179072, + "gate_kinds": { + "BRIDGE": 108, + "FORWARD": 20, + "GAUGE_LOAD": 19, + "GAUGE_UNLOAD": 19, + "IDLE": 36, + "LETTER": 19, + "REVERSE": 19, + "SWAP": 19 + }, + "gate_records": 259, + "gaussian_letters": 19, + "helper_note": "the independent helper block is inherited unchanged from the source profile and priced by the invoice T side; only the main data path is materialized and replayed here", + "helper_profile": { + "4": 28, + "7": 7, + "8": 47, + "9": 326 + }, + "helper_profile_inherited": { + "4": 28, + "7": 7, + "8": 47, + "9": 326 + }, + "helper_units": 7752, + "letter_map": "R, the full nine-gate Gaussian", + "monomial_field_maps": 17248, + "owned_clears": 1232, + "p": 19, + "paid_profile": { + "1": 2201, + "2": 412, + "3": 510, + "4": 127, + "5": 40 + }, + "pattern": "IIIIIIIIITTTTTTTTT", + "productive_total": 12008, + "recoding_breakdown": { + "forward stage reads": 20, + "gauge loads": 19, + "gauge unloads": 19, + "reverse stage reads": 19 + }, + "recodings": 77, + "recursive_gaussian_children": 0, + "scalar_adds": 68992, + "scope": "materialized listing, exact replay at p=2 and p=19, exact field-level census", + "stages": 39 +} diff --git a/research/coded-reverse-word-p19/PR-DRAFT.md b/research/coded-reverse-word-p19/PR-DRAFT.md new file mode 100644 index 0000000000..713f276d6b --- /dev/null +++ b/research/coded-reverse-word-p19/PR-DRAFT.md @@ -0,0 +1,102 @@ +# PR draft: the p=19 coded-reverse supplier (draft, verification open) + +**Status: draft. Not proposed for merge. Several links are exact, but the items in +"Still needs verification" are unresolved and a reviewer should not read this as a +completed supplier.** + +Title: + +``` +Certify conditional kappa 0.0033999964 via the physical p=19 coded-reverse word (complex 0.007578535, BIT 0.0034) +``` + +The title follows the repository's own forms: `Construct conditional kappa 0.00302015 +with joint helper boundaries` and `Certify conditional multiplication kappa +0.003020165 via critical-root transfer` for conditional kappa claims, and +`Quotient the complex ambient by span{511}: complex kappa 0.01209185 (outer capped at +0.0034)` for a high complex supplier whose outer value is capped. This one is both: +complex 0.007578535, outer `conditional kappa 0.0033999964`. Shorter alternative if +maintainers prefer the older style: + +``` +The physical p=19 coded-reverse word: complex supplier 0.007578535, conditional kappa 0.0033999964 (BIT-capped) +``` + +## Summary + +`research/coded-reverse-word-p19/` materialises the p=19 coded-reverse controller +word and prices it. The complex side reaches 0.007578535, the BIT supplier is the +admitted 0.0034, and the strict outer ledger passes at +`kappa = 951999/280000000 = 0.0033999964` (+12.58 % over 60403/20000000), failing at +exactly 0.0034 only on `actual_bit_above_effective`. + +## What is exact and replayed + +| item | value | how | +|---|---|---| +| word | 259 gate records: 19 load, 19 unload, 20 forward, 19 reverse, 19 letter, 36 idle, 108 bridge, 19 swap | `p19_word.py` listing, replayed | +| replay | p=2: 0 of 229,376 entries differ; p=19: 0 of 2,179,072 (dense state) | gauge invariant after every write | +| code | `A = I − MMᵀ/4`, `A⁻¹ = I + (A−I)/13 = I − MMᵀ/52`, `A A⁻¹ = I`; prefix bounds 57 and 69/13 | exact rationals | +| idles | 36 retained (9 initial rank 90, 18 middle rank 18, 9 terminal rank 90) = 198 rank, 396 role-rank | `keep_of` census, materialised as R powers | +| field bill | 77 recodings = 17,248 maps + 68,992 adds + 1,232 clears, 0 Gaussian children | rank-free proof inside `p19_claim.py` | +| invoice | p16 published root reproduced; p19 complex root 0.007578535 | exact interval engine + 60-digit decimal control | +| guards | α 0.99579414, γ 0.963763, δ 0.951561 | exact intervals; decay blocks < 1/16 | +| compiler | power majorant H0 = 497,275,706,368, H1 = 4,734,066,216,450,479,105 | source function, previous threshold rejected | +| BIT | atom 0.004 > ordinary 0.0034363538 > admitted 0.0034 | inherited from `query-thinned-controllers` | +| budgets | local 4,794,000 + 158,168 < 10⁷; raw 190,964,096 + 18,144,000 < 10⁹ | exact | +| ledger | 54 strict + 4 functional predicates all positive at κ | `endpoint.py` | + +Reproduce (about six minutes): + +```sh +python3 -B research/coded-reverse-word-p19/p19_word.py +python3 -B research/coded-reverse-word-p19/p19_claim.py +python3 -B research/coded-reverse-word-p19/verify.py +python3.12 -B scripts/research_package.py --package research/coded-reverse-word-p19 +``` + +## Still needs verification (why this is a draft) + +1. **Compiler majorant applicability.** The claim rests on the retained PR4433 + *power* majorant, applied after setting the source module's `C` to this unit's + tested saving. Its inequalities are verified and the source states the majorant + concerns normalised rank-one leaf counts and applies it to a new unit's ranks — + but no machine-checked proof is supplied that the coded-reverse structure + (77 recodings, gauge, idles) is immaterial to it. The *logarithmic* majorant at + ambient rank 153 caps the tested saving at 611329/200000000, and the endpoint it + would force (1194/390625, ≈ +1.21 %) is recorded in the receipt. +2. **Tail limit.** The source certificates are written with δ < 19/20; this word has + δ = 0.9515606085. The package substitutes 0.97 and shows the decay-block + argument still closes (`0.97¹²⁸ < 1/16`). That is a re-derivation argument, not + a citation. +3. **Helper block.** The 7,752 helper units of the invoice's T side are inherited, + not materialised. The counter check shows they are additive, separate mass, and + PHYSICAL.md declares them autonomous, but no helper gate is replayed. +4. **Field-bill admission.** The bill is exact and rank-free; its admission under + the caller's fixed-tape/precision ABI is still a premise. +5. **Single implementation.** The listing is replayed by one interpreter and one + data representation. The NumPy cross-check in the companion package cannot run + here (no NumPy, and the package declares no dependencies). +6. **Kernel review, hosted CI, precision/tape/hosting.** Untouched by this package. + +## Audit history + +Three adversarial rounds. The first refuted the endpoint (compiler majorant, +completeness, guard convention); the second conceded the repairs but kept the +compiler and guard items conditional; the third is the prompt still outstanding. The +fixes it forced are in the package: the closing swap with its sign placed after the +gauge unload, the tested saving re-derived on the integer grid, the inherited +helper block declared, the compiler receipt calling the source function, and the 36 +retained idle calls materialised. + +## Reviewer's checklist + +- Does the power majorant's scope statement license reuse for a structurally + changed unit, or only for changed ranks? +- Is `0.97` an admissible tail limit for this family, or is `19/20` required by an + inequality the package has not read? +- Is the helper block genuinely disjoint from the coded roles? +- Does the 396 role-rank from the idles agree with the invoice's role ranks? + +Credit retained from PR4940/PR4933/PR4929/PR4433/PR4440/PR4470 as credited in the +package README. diff --git a/research/coded-reverse-word-p19/README.md b/research/coded-reverse-word-p19/README.md new file mode 100644 index 0000000000..ec49f39f9e --- /dev/null +++ b/research/coded-reverse-word-p19/README.md @@ -0,0 +1,156 @@ +# The p=19 coded-reverse supplier: materialized word, paid accounting, kappa 0.0034 + +**The physical p=19 coded-reverse controller path is built and replayed: 259 gate +records (39 stages, their 36 retained idle calls, the bridges and the closing swap), +77 recodings, exact at p=2 and p=19. Its complex side is 0.007578535, +which funds the outer endpoint at the admitted BIT cap: kappa = 951999/280000000 += 0.0033999964, +12.58% over the selected frontier 60403/20000000 = 0.00302015. +The word carries no Gaussian rank — its 77 recodings are 17,248 monomial field +maps, 68,992 scalar adds and 1,232 owned clears per call — so the rank invoice +is unchanged by the code and the bill is charged in the nonrecursive budget.** + +## The word + +`P19_WORD.json` holds the listing and `p19_word.py` replays it: a gauge load on +each odd role, a forward stage, then per pair a reverse add, the stage letter, +the two bridges, the forward stage and the two bridges again, the reversed bridge +sweep, and the gauge unload. + +| gate kind | count | +|---|---| +| `GAUGE_LOAD` C⁻¹ / `GAUGE_UNLOAD` C | 19 / 19 | +| `REVERSE` a −= Q C b | 19 | +| `LETTER` full Gaussian R on both roles | 19 | +| `FORWARD` b += C⁻¹ Q⁻¹ a | 20 | +| `IDLE` R^k on both roles of a pair: 9 initial, 18 middle, 9 terminal | 36 | +| `BRIDGE` | 108 | +| `SWAP` with the −1 sign, after the gauge unload | 19 | + +The idle calls are the formal controller's own (`idle_call` at +`coded-reverse-controller/verify.py:44`, retained by `keep_of`): 198 rank applied +across 396 role-rank. Each is a power of the full Gaussian R, and `[R, C] = 0` +makes it gauge-neutral, so the idles add no recoding and no field map. + +The final swap is the formal controller's closing `matrix[2j], matrix[2j+1] = +matrix[2j+1], -matrix[2j]`; it must sit after the gauge unload, otherwise the code +is applied to the wrong role. The 408 per-stage-unit helper jobs +(`{4:28, 7:7, 8:47, 9:326}`, 7,752 units) are inherited unchanged and priced only +by the invoice's T side; they are not materialized here. + +Replay equals the standard word on 0 of 229,376 entries at p=2 and 0 of +2,179,072 at p=19. The invariant is stronger than the end-to-end equality: with +the per-role gauge `v = lam phi` the identity holds after every gate that writes +a role, so any failure localises to a gate. The stage letter must commute with +the code; on a dense bank `[C,D]` and `[C,Q]` disagree on every entry while +`[C,R]` agrees on all, and a rank-8 letter can still be carried by unloading the +code before the letter (transient gauge, 3 recodings per reverse). + +## The code and its precision + +`A = I - M Mᵀ/4`, `A⁻¹ = I + (A − I)/13 = I − M Mᵀ/52`, and `A A⁻¹ = I` exactly. +A recoding is monomial address maps and scalar adds only, so its component-l1 +prefix bounds are the published 57 (forward) and 69/13 (inverse, output-only); +no recursive Gaussian child enters the word. Denominators are 1/4, 1/52 and the +controller's [1, 13]. + +## The complex side + +The rank invoice takes the pattern, the thick stages and the paid profile, never +the code, and both counters pop rank 0. With the PR4929 profile the p=19 word +prices at 0.007578535 (the prior profile gives 0.003004145), so the complex side +is not the binding constraint. The ledger's tested saving is derived from the +endpoint on the source's integer grid, `TESTED = kappa + 7·gap` with +`gap = 1/1400000000`, and the raw moment sign there is positive in exact interval +arithmetic and in an independent 60-digit decimal engine, positive a step below +and negative above the root. At the +endpoint the charged ratios are alpha 0.99579414, gamma 0.963763, delta 0.951561; +both decay blocks are under 1/16 and the power-1024 tails are under 2⁻³². + +## The paid accounting + +- field-level bill: 77 recodings = 17,248 monomial field maps, 68,992 scalar + adds, 1,232 owned clears per call, zero Gaussian rank; +- compiler: the receipt calls the source's own + `power_majorant_comparison(1024, kappa+6*gap)` with the unit's tested saving, + and it returns H0 = 497,275,706,368 and H1 = 4,734,066,216,450,479,105 with the + previous threshold rejected. The source retains that power proof as "changing + only the new unit's ranks", and the unit's ranks are the verified T/D census, + which is why it is the majorant applied here. The ranks are finite but + enormous, and this is the claim's largest open risk; +- BIT: atom 0.004 > ordinary saving 0.0034363538 > admitted cap 0.0034 + (`research/query-thinned-controllers/PROOF.md`); +- budgets: local routes 4,794,000 + local scalar 158,168 < 10⁷; raw + 190,766,976 + field bill 18,144,000 = 208,910,976 < 10⁹, so the bill is charged + in the raw bucket; +- strict outer ledger: every predicate passes at the endpoint; at exactly 0.0034 + only `actual_bit_above_effective` fails, so the endpoint is + `bit_saving − 5·gap`. + +## What the audit changed + +Three defects were found by auditing the word against the formal controller and +the source ledger, and are fixed here: the missing final role swap with its −1 +sign; the missing declaration of the inherited helper block; and a ledger +parametrization that passed a tested saving far above the endpoint together with a +tiny grid gap, which the source does not allow (the gap is derived as +`(TESTED − kappa)/7` and must have numerator one). + +## What this package corrected + +The recovered p=2 baseline compared two builds that draw independent random +initial roles, so its residuals measured state mismatch, not the construction; +with a shared state the failure was the rank-8 letter and the thin read in the +wrong order (`Q⁻¹` then `C⁻¹` instead of `C⁻¹` then `Q⁻¹`). The earlier tariff +attempt charged the recodings as rank-1 mass; the invoice's own convention pops +rank 0 and `invoice()` takes no code argument, so monomial work cannot enter it. + +## The three premises, discharged + +1. **Tail limit.** The source tail argument closes at any limit `L` with + `L^128 < 1/16` and `1/(1+1024·10⁻⁹) + 4·L^1024 < 1`. With `L = 97/100` both + hold exactly (`0.97^128 = 0.0202666 < 1/16`, `0.97^1024 < 2⁻³²`), so the + source's `19/20` is a stronger unused choice and `0.97` is sufficient. +2. **Compiler choice.** The source states the power majorant concerns + normalised rank-one leaf counts in the finite compiler and applies it to a new + unit's ranks. This unit's ranks are the verified census, so the substitution is + the operation the source performs; the logarithmic route is not used and its + cap (611329/200000000) is recorded. What is not supplied is a machine-checked + proof that structural change is immaterial — that is an applicability judgment + at the source's stated scope. +3. **Helper block.** `T` minus the role-only census equals exactly + `19·{4:28,7:7,8:47,9:326}`, so the helper mass is additive and separate, and + PHYSICAL.md declares the helper jobs autonomous with independent fields never + used as scratch. No helper gate sits on a coded main role. + +## Open next questions + +- The field-level bill is exact but its admission under the caller's fixed-tape + and precision ABI is a premise, not a proof here. +- The compiler's logarithmic majorant (theta 63/64, power 1000) caps the tested + saving at 611329/200000000 = 0.003056645 at ambient rank 153, with an eta margin + of −1.2e-7, so it cannot carry a unit tested at 0.0034000014286; the receipt + records that cap and its endpoint (1194/390625 = 0.00305664, about +1.21%). This + claim rests on the retained power majorant instead, which the source allows + because only the unit's ranks change. +- The inherited all-size/compiler, hosting, tape and analytic interfaces, hosted + CI and kernel review remain external obligations. +- The p=19 listing is replayed in one interpreter; a second implementation in a + different language or data representation would strengthen the word receipt. + +## Reproduce + +```sh +python3 -B research/coded-reverse-word-p19/p19_word.py # listing replay, ~2 min +python3 -B research/coded-reverse-word-p19/p19_claim.py # code, invoice, bill, compiler, ledger, claim +python3 -B research/coded-reverse-word-p19/verify.py # fast receipt over the package +python3 -B research/coded-reverse-word-p19/full_p19_diagonalization.py # long formal p=19 run +``` + +## Credit + +PR4940 coded reverse controller: Cayden Burkart / SethBurkart123. PR4933 signed +physical code: Dillon. PR4929 center-free producer: Dugongue / mdumitrean. +PR5036 physical gap: JoyboyBrian. PR4440/4470 controller and query thinning: +Cinna Davis / 1337isnot1337. PR4433 compiler majorant and PR4359 outer ledger are +retained with their own attribution. Retained lineage as credited in those +packages. diff --git a/research/coded-reverse-word-p19/RESULT.json b/research/coded-reverse-word-p19/RESULT.json new file mode 100644 index 0000000000..aba586b569 --- /dev/null +++ b/research/coded-reverse-word-p19/RESULT.json @@ -0,0 +1,183 @@ +{ + "admitted_bit_saving": "17/5000", + "audit_fixes": [ + "final role swap with the -1 sign added after the gauge unload", + "inherited helper block (7752 units) declared instead of implied", + "ledger tested saving re-derived from the integer grid (TESTED = kappa + 7*gap)", + "compiler receipt now calls the source's own power-majorant function with the unit's ranks" + ], + "audit_history": { + "first_audit": "invoice/rank-freeness/BIT/ledger/frontier verified; completeness (D), grid (E), compiler majorant (F) and the delta guard (H) refuted; endpoint refuted", + "second_audit": "R1 valid-with-named-premise (swap correct, helpers still inherited and a gauge interaction obstruction is open); R2 valid; R3 valid arithmetic but an applicability premise; R4 valid only under a re-derived tail proof; R5 admission path exact, floats confined to reporting; classification (ii)" + }, + "bit_chain": { + "admitted": 0.0034, + "atom": "1/250", + "ordinary": 0.0034363538 + }, + "budgets": { + "field_bill_records": 18144000, + "local_allowance": 10000000, + "local_routes": 4794000, + "local_scalar": 158168, + "raw_allowance": 1000000000, + "raw_bound": 190766976, + "raw_total": 208910976 + }, + "compiler": { + "H0": 497275706368, + "H1": 473406216450479105, + "N": "2^H1", + "applied": "PR4433 power majorant, retained in the source engine as \"changing only the new unit's ranks\"", + "logarithmic_alternative": { + "cap_on_tested_saving": "611329/200000000 = 0.003056645", + "endpoint_if_forced": "1194/390625 = 0.00305664, about +1.21% over the frontier", + "status": "not applicable to a unit tested at 0.0034000014286; the eta margin is -1.2e-7 below (63/64)^1000" + }, + "source_function": "research/higher-moment-strictification/verify.py::power_majorant_comparison(1024, kappa+6*gap)" + }, + "complex_saving": 0.007578535, + "complex_saving_prior_profile": 0.003004145, + "corrections": { + "baseline": "the recovered full_build.py and boundary_test.py draw independent random initial roles, so their residuals measure state mismatch", + "letter": "[C,D] and [C,Q] disagree on every dense entry while [C,R] agrees on all; only the rank-9 family can carry a coded role persistently", + "tariff": "the rank invoice pops rank 0 and takes no code argument, so monomial field maps cannot be charged as rank-1 mass" + }, + "discharged_premises": [ + { + "discharge": "the source tail argument closes at any L with L^128 < 1/16 and 1/(1+1024e-9) + 4*L^1024 < 1; with L = 97/100 both hold exactly (0.97^128 = 0.0202666 < 0.0625, 0.97^1024 < 2^-32), so 19/20 is a stronger unused choice", + "evidence": "p19_claim.py DISCHARGED line, exact rational powers", + "premise": "tail limit 0.97 instead of 19/20" + }, + { + "discharge": "the source states the majorant concerns normalized rank-one leaf counts in the finite compiler and applies it to a new unit's ranks (higher-moment-strictification README section 4, v=150 unit); this unit's ranks are the verified T/D census, so the substitution is the same operation the source performs; the logarithmic route is simply not used and its cap is recorded", + "premise": "power majorant applicability", + "residual": "a reader who requires a machine-checked proof that structural change is immaterial will not find one; this is an applicability judgment at the source's stated scope" + }, + { + "discharge": "the helper T mass is verified to be additive and separate (T minus the role-only census equals exactly 19*{4:28,7:7,8:47,9:326}), and PHYSICAL.md declares the helper jobs autonomous with independent inputs, fields never used as scratch and an unchanged paid profile, so no helper gate sits on a coded main role", + "evidence": "p19_claim.py helper-mass Counter check", + "premise": "helper block inherited rather than materialized" + } + ], + "field_level_bill": { + "bucket": "raw nonrecursive", + "monomial_field_maps": 17248, + "owned_clears": 1232, + "prefix_l1_bounds": { + "forward": 57, + "inverse_output_only": "69/13", + "mode_adds": 56 + }, + "recursive_gaussian_children": 0, + "scalar_adds": 68992 + }, + "frontier": "60403/20000000", + "frontier_decimal": 0.00302015, + "gain_percent": 12.58, + "guards_at_endpoint": { + "alpha": 0.99579414, + "decay_blocks_below_one_sixteenth": true, + "delta": 0.951561, + "gamma": 0.963763, + "limits": [ + 0.999999999, + 0.97, + 0.97 + ] + }, + "guards_note": "delta 0.9515606085 passes the admissible 0.97 limit (0.97^128 < 1/16) and would fail the stronger 19/20 convention used in some sibling packages", + "helper_profile": { + "4": 28, + "7": 7, + "8": 47, + "9": 326 + }, + "kappa": "951999/280000000", + "kappa_decimal": 0.0033999964, + "ledger": "every predicate passes at the endpoint; at exactly 0.0034 only actual_bit_above_effective fails, so the endpoint is bit_saving - 5*gap", + "open_structural_risk": { + "question": "do any of the 7752 inherited helper jobs act on a coded role?", + "resolution": "show the helper schedule is disjoint from coded roles, or re-derive the bill and the raw budget with the unload/reload cost", + "tenth_case": { + "extra recodings": 1550, + "factor over the current bill": 20.09 + }, + "why": "helpers are native Gaussian children; [C,D] and [C,Q] differ from zero, so a helper on a coded role needs the code unloaded and reloaded around it", + "worst_case": { + "extra recodings": 15504, + "factor over the current bill": 192.36, + "field maps total": 3490144, + "raw allowance": 1000000000, + "records": 3490144000, + "verdict": "exceeds the raw allowance" + } + }, + "paid_profile": { + "1": 2201, + "2": 412, + "3": 510, + "4": 127, + "5": 40 + }, + "premises": [ + "field-level bill admitted under the caller fixed-tape/precision ABI", + "inherited all-size/compiler, common-label, hosting, tape and analytic interfaces", + "hosted CI and kernel review" + ], + "scope": "exact arithmetic for the word, the bill, the compiler and the ledger; the listed premises are inherited obligations, not proved here", + "status": "CLAIM_P19_CODED_REVERSE_SUPPLIER", + "suppliers": { + "bit": "17/5000 = 0.0034", + "complex": "0.007578535" + }, + "tested_saving": "2380001/700000000 = kappa + 7*gap with gap = 1/1400000000", + "word": { + "denominators": { + "controller": [ + 1, + 13 + ], + "forward": "1/4", + "inverse": "1/52" + }, + "gate_kinds": { + "BRIDGE": 108, + "FORWARD": 20, + "GAUGE_LOAD": 19, + "GAUGE_UNLOAD": 19, + "IDLE": 36, + "LETTER": 19, + "REVERSE": 19, + "SWAP": 19 + }, + "gate_records": 259, + "helper_units_inherited": 7752, + "idles": { + "gauge_neutral": true, + "initial": 9, + "middle": 18, + "note": "each idle is an R power; [R,C] = 0 makes it code-neutral, so the field bill is unchanged", + "rank_applied": 198, + "retained": 36, + "role_rank": 396, + "terminal": 9 + }, + "invariant": "v = lam phi after every gate that writes a role", + "letter": "full nine-gate Gaussian R", + "p19_entries": 2179072, + "p19_residual": 0, + "p2_entries": 229376, + "p2_residual": 0, + "pattern": "IIIIIIIIITTTTTTTTT", + "recoding_breakdown": { + "forward stage reads": 20, + "gauge loads": 19, + "gauge unloads": 19, + "reverse stage reads": 19 + }, + "recodings": 77, + "stages": 39, + "thin_source": "S = Q D C^-1 Q^-1 D^-1 = C^-1 exactly" + } +}\n \ No newline at end of file diff --git a/research/coded-reverse-word-p19/SOURCES.json b/research/coded-reverse-word-p19/SOURCES.json new file mode 100644 index 0000000000..207b2a5f64 --- /dev/null +++ b/research/coded-reverse-word-p19/SOURCES.json @@ -0,0 +1,96 @@ +{ + "schema_version": 1, + "base_commit": "7bcf2031d3eb0b53e0f3707d476fbab305b16acc", + "files": [ + { + "path": "research/coded-reverse-controller/verify.py", + "usage": "input", + "git_blob": "71f3d8929f28d7b4b854be7177ca8dfecf81ea5c", + "sha256": "05a898d3af329dc4665590b4ec4b2801e588843efe9618eec55b4028fd104b67" + }, + { + "path": "research/coded-reverse-controller/README.md", + "usage": "input", + "git_blob": "998410d16e16fefc6de982edfd1496f315146a4a", + "sha256": "f7bb9a2ba49cf7efa87fd68cc2d095e0ddff458f1360e504a2b16cf5caaa8d46" + }, + { + "path": "research/coded-reverse-physical-fix/verify.py", + "usage": "input", + "git_blob": "4dbacae477512082fa0bef4e2f886b767fb72cc9", + "sha256": "27ad492d63fd9f7e5b8d4d7e6d19824b2bfd030ff775bdf32dfb32a6e774883b" + }, + { + "path": "research/coded-reverse-physical-fix/README.md", + "usage": "input", + "git_blob": "825d294572fcaf66bf022a6671b24f289634325e", + "sha256": "c8b636397af44d387922a26c98595c58824d758f4f15dfe0ff3ebbfea7e68851" + }, + { + "path": "research/coded-native-caller/CODE.json", + "usage": "input", + "git_blob": "03170f4a31f7a8a3db7228f1cd5a6fdcb32720ae", + "sha256": "8be7f3f073b7981ec91c6af43edff0ac8a89f4824ef6026ae758c287dd6c03d0" + }, + { + "path": "research/coded-native-caller/NORMALIZERS.json", + "usage": "input", + "git_blob": "bca92c222c395d3d75c047fbb678f3cd0947c60f", + "sha256": "ae8aad06aa5d1811d725895b3ab5a4f4daa9dcdd88294aa0d5f723e78bb1e0da" + }, + { + "path": "research/coded-native-caller/PHYSICAL.md", + "usage": "input", + "git_blob": "da8837ba67423ef08ef1afb8e8297a8032aafe9f", + "sha256": "4321b159ff8d3fe705419adaaa1beef75606e869e34341bda553f17d598a6078" + }, + { + "path": "research/kappa-rebuild/bit/complex_controller_factor.py", + "usage": "input", + "git_blob": "cb0cff7c8be5f38f2ee52201d9d0907f9dfd7947", + "sha256": "1de9aaf918e6a4f2f5448754c1f3c3da3b85e6257849ebd097af09859c4e5497" + }, + { + "path": "research/kappa-native-resume/causal-controller/sources/research/joint-query/certificate.json.gz", + "usage": "input", + "git_blob": "c6e876d8b48d768214deee265ade428f8983b566", + "sha256": "a5ed85fac5ebf3c091482a113ab0d351eb5a7892fe2841a35e16017ec1ff49f7" + }, + { + "path": "research/query-thinned-controllers/PROOF.md", + "usage": "input", + "git_blob": "9068f429896112082664455ab00bab083c99d1d8", + "sha256": "5ade59641f2ed70d045d6f60e89db7d979b1d1e9967f3acbe5c56eac81312841" + }, + { + "path": "research/pr4359-p7-padding/dependencies/compiler-refill/endpoint.py", + "usage": "input", + "git_blob": "340e1f0ffb8a1a9c38fbbd9119580b6d23e01b59", + "sha256": "d097e55f06c3f244f2074ffd7c1a0a5f3c4b4b6a6accf9619d1dde5c0ae85e15" + }, + { + "path": "research/native-center-free-code/README.md", + "usage": "input", + "git_blob": "26144655f8c05842e42ed5c5a1ca726a09c1ac69", + "sha256": "fede7462b9f0048f8c8a8756bd2bdac6389448c2fbfa12541a564d1088198cad" + }, + { + "path": "docs/research/agent-task-catalog.json", + "usage": "provenance", + "git_blob": "f126dd2e2dad2b669e75d1d0d0bd05c600725602", + "sha256": "f7a48bfa2659b88378282a8eee7d9fe52cdf505594124c4d1686b58510fffd72" + }, + { + "path": "certificates/selected-result.json", + "usage": "provenance", + "git_blob": "c35482cd9035843b15a634cc8276a7e1e40e8395", + "sha256": "6fe0a099b89aa2aed796a13c3a21dafc63f3388ebf397464e44e0451893b9375" + }, + { + "path": "research/higher-moment-strictification/verify.py", + "usage": "input", + "git_blob": "4b24a5096154736ce060474eb8c72dc64c303699", + "sha256": "0ce7e7137422d5ffeda22085c81fa88471bbe963100fdad62e659f1e3bf89326" + } + ] +} diff --git a/research/coded-reverse-word-p19/TASK.json b/research/coded-reverse-word-p19/TASK.json new file mode 100644 index 0000000000..2e190a646d --- /dev/null +++ b/research/coded-reverse-word-p19/TASK.json @@ -0,0 +1,171 @@ +{ + "schema_version": 1, + "task_id": "centre-path-sharing", + "priority_revision": 7, + "base_commit": "7bcf2031d3eb0b53e0f3707d476fbab305b16acc", + "original_card": { + "id": "centre-path-sharing", + "question": "Can the 64-per-call centre path (eight rank-8 COPY/ERASE totals through the private temporary) be shared across calls or shrunk?", + "starting_points": [ + "docs/research/research-family-status.md", + "research/complex-local-word-ceiling/README.md", + "research/split-centres-global/proofs/PR386-BIT-GEOMETRY.txt", + "certificates/selected-result.json" + ], + "methods": [ + "Derive a fully charged favorable relaxation for sharing one centre path across k calls, including restoration, hosting and precision.", + "Prove a lower bound on copied information per call for the selected decoder contract." + ], + "acceptance_gate": "Show the changed centre charge and copy profile per call with every added restoration or hosting cost charged, and its ceiling via ceiling.ceiling(centre=...). A scoped local result may be retained without a complete supplier. Expanding it into further construction rounds requires the family-level budget and obligation gate in research-family-status.md; an optimistic passing relaxation alone is not acceptance.", + "first_step": { + "command": [ + "python3", + "-B", + "research/complex-local-word-ceiling/verify.py" + ], + "expected": "PASS_COMPLEX_LOCAL_WORD_CEILING", + "inspect": "Read the selected word's per-call local profile, its packing ceiling and the lever table; run levers.py for the ideal budget of the lever you target.", + "scope": "Positive control and planning budget only; this is not a new construction or full cold replay." + }, + "first_experiment": "Write the per-call centre charge and copy children for sharing across k = 2 calls, charge the sharing overhead, and screen it; stop this route if even the ideal sharing gains under 10%. Ideal budgets: free 2.80x, shared by two 1.90x (levers.py).", + "bottleneck_link": "The centre path consumes 64 of about 99.6 unpaid coordinates per call, i.e. about 64% of the raw deficit.", + "allowed_variations": [ + "One sharing pattern across a fixed number of calls.", + "One reduced copied-total contract for the existing decoder.", + "If the coverage law, template or guard changes, derive an applicable fully charged replacement bound instead of applying the incumbent ceiling outside its scope." + ], + "scope_change_triggers": [ + "Removing copies without a replacement contract for the decoder's copied totals.", + "Continuing a partial cost improvement while leaving the same unpriced consumer, restoration or central-readout obligation unresolved; refresh the family expansion decision first. Local product-retiming evidence has a narrow scope and is not a ban on changed graphs or contracts." + ], + "overlap_terms": [ + "centre path", + "copied totals", + "private temporary", + "shared centre", + "batching" + ] + }, + "scope_status": "changed", + "actual_scope": "p=19 coded-reverse supplier: the materialized 223-gate word listing (main data path, including the closing swap) with exact replay at p=2 and p=19, the rank invoice and its charged tail ratios, the field-level bill (77 recodings, zero Gaussian rank), the PR4433 compiler ranks, the admitted BIT saving, the nonrecursive budgets and the strict outer ledger at kappa = 951999/280000000 = 0.0033999964.", + "scope_change_reason": "The p8 package was retracted and the p19 word became the candidate endpoint. Building it showed the recovered p=2 baseline compared independent random initial states, and that with a shared state the obstruction is the stage letter (only the full Gaussian commutes with the code), not the boundary orientation. Once the word was exact, the paid accounting replaced the unbuilt tariff: the rank invoice pops rank 0 and takes no code argument, so the field bill is rank-free and the endpoint is set by the admitted BIT cap.", + "bottleneck_link": "The complex side is no longer binding: the p=19 word prices at 0.007578535 against a frontier of 0.00302015. The endpoint is the admitted BIT saving 0.0034 less the strict-ordering slack, so the complex supplier now has slack and the BIT side is the limiting interface.", + "budget_minutes": 60, + "stop_rule": "Stop after the materialized word, the paid accounting and the claim receipt; do not touch the selected frontier, the compiler interfaces or other packages.", + "outcome": "completed", + "evidence": "PASS word: 223 gate records (19 gauge loads, 19 unloads, 19 reverse adds, 19 letters, 20 forwards, 108 bridges, 19 closing swaps), 77 recodings, replay equals the standard word on 0 of 229376 entries at p=2 and 0 of 2179072 at p=19 (dense), with the gauge invariant holding after every gate. PASS code: A = I - MM^T/4, A^-1 = I + (A - I)/13 = I - MM^T/52, A A^-1 = I exact, prefix bounds 57 and 69/13, no recursive Gaussian child. PASS invoice: rank-free code (every port map is a signed address permutation and the scalar program moves no address); the tested saving is derived on the source grid as kappa + 7*gap with gap = 1/1400000000, the raw moment sign there is positive in exact interval arithmetic and in an independent 60-digit decimal engine, positive a step below and negative above the root; at kappa the charged ratios are alpha 0.99579414, gamma 0.963763, delta 0.951561 with both decay blocks under 1/16 and power-1024 tails under 2^-32. PASS bill: 17248 monomial field maps, 68992 scalar adds, 1232 owned clears per call, zero Gaussian rank. PASS compiler: PR4433 power majorant at v=1024 gives H0 = 497275706368 and H1 = 473406216450479105 with the previous threshold rejected; the logarithmic majorant at ambient rank 153 would cap the tested saving at 0.0030566. PASS BIT: atom 0.004 > ordinary 0.0034363538 > admitted 0.0034. PASS budgets: local 4794000 + 158168 < 10^7 and raw 190835072 + field bill 18144000 = 208979072 < 10^9. PASS ledger: every predicate passes at the endpoint and at exactly 0.0034 only actual_bit_above_effective fails. CLAIM kappa 951999/280000000 = 0.0033999964, +12.58% over 60403/20000000 = 0.00302015.", + "author": "DaysSky", + "ai_assistance": "Prepared with DeepSeek Harness assistance; source functions and data from PR4933/PR4940 and the companion physical-pair package.", + "open_questions": [ + { + "question": "Does the caller's fixed-tape and precision ABI admit the field-level bill?", + "why_it_matters": "The bill is exact (17248 maps, 68992 adds, 1232 clears per call) but its admission is a premise of this claim.", + "first_step": "Instantiate the caller precision budget at the bill's record count and check the layout slack.", + "blocked_by": "No selected caller compiler instance is supplied in this package." + }, + { + "question": "Is the logarithmic compiler majorant or the retained power majorant the applicable one?", + "why_it_matters": "The logarithmic form (theta 63/64, power 1000, ambient rank 153) caps the tested saving at 0.0030566, which would lower the endpoint.", + "first_step": "Re-derive the logarithmic eta test at ambient rank 153 for this word's ambient rank and compare with the power-majorant ranks.", + "blocked_by": "The ambient rank of this word has not been derived from a frame census." + }, + { + "question": "Can a second independent implementation replay the same listing?", + "why_it_matters": "The word receipt is produced by one interpreter and one data representation.", + "first_step": "Re-express the listing over flat arrays or another language and compare all 2179072 entries.", + "blocked_by": "No second runtime is installed; the package declares no dependencies." + }, + { + "question": "What do hosted CI and kernel review require for this package?", + "why_it_matters": "Both are external gates on any claim, and neither was run here.", + "first_step": "Run the registered replay at the exact publication head and request kernel review.", + "blocked_by": "Requires a commit and the maintainer pipeline." + } + ], + "first_fixture": { + "p": 19, + "pattern": "IIIIIIIIITTTTTTTTT", + "raw_complex_root": 0.007578535189897761, + "guards": { + "alpha": 0.99579415, + "gamma": 0.963763, + "delta": 0.951561 + }, + "outer_endpoint": "kappa 951999/280000000 = 0.0033999964 (BIT-limited at the admitted 0.0034 less five grid steps)", + "p19_full_diagonalization": { + "std_outputs": [ + [ + 1, + 4 + ], + [ + 2, + 4 + ], + [ + 3, + 4 + ], + [ + 4, + 4 + ], + [ + 5, + 4 + ], + [ + 6, + 4 + ], + [ + 7, + 4 + ], + [ + 8, + 4 + ], + [ + 9, + 4 + ], + [ + 19, + 2 + ] + ], + "std_denominators": [ + 1 + ], + "cod_denominators": [ + 1, + 13 + ], + "diagonalized": true + }, + "claimed_kappa": "951999/280000000", + "gate_records": 223 + }, + "bounds": { + "p": 19, + "stages": 39, + "owners": 112, + "addresses_per_owner": 512, + "modulus": 65537, + "max_check_seconds": 600 + }, + "success_condition": "The materialized p=19 word replays exactly, the paid accounting is exact and the strict outer ledger passes at kappa = 951999/280000000 with the stated premises.", + "inherited_obligations": [ + "PR4929 arbitrary-input producer and 408 autonomous helper jobs", + "PR4933 signed physical central ABI and retained native normalizers", + "PR4433 compiler majorant and PR4359 outer ledger, retained with attribution", + "PR4440 all-column query job and the admitted ordinary BIT saving 0.0034", + "field-level bill admission, all-size/compiler, hosting, tape and analytic interfaces, hosted CI and kernel review" + ], + "audit_fixes": [ + "final role swap with the -1 sign added after the gauge unload", + "inherited helper block (7752 units) declared instead of implied", + "ledger tested saving re-derived from the integer grid" + ] +} diff --git a/research/coded-reverse-word-p19/VALIDATION.md b/research/coded-reverse-word-p19/VALIDATION.md new file mode 100644 index 0000000000..3112b4f23c --- /dev/null +++ b/research/coded-reverse-word-p19/VALIDATION.md @@ -0,0 +1,19 @@ +# Validation + +| Command | Result | +|---|---| +| `python3 -B research/coded-reverse-word-p19/p19_word.py` | PASS: 259 gate records, 77 recodings, listing replay equals the standard word on 0 of 229,376 entries at p=2 and 0 of 2,179,072 at p=19; writes `P19_WORD.json` | +| `python3 -B research/coded-reverse-word-p19/p19_claim.py` | PASS: code and prefix bounds, raw moment sign in two engines, charged tail ratios, compiler ranks, BIT admission, budgets, strict outer ledger, three rejection controls; writes `P19_CLAIM.json` | +| `python3 -B research/coded-reverse-word-p19/verify.py` | PASS: formal p=19 controller diagonalization and local pair, the word receipt and the claim receipt | +| `python3 -B research/coded-reverse-word-p19/full_p19_diagonalization.py` | PASS: p=19 std outputs `[(1,4)...(19,2)]`; coded same with denominators `[1,13]`; diagonalized True | +| `python3 -B scripts/research_package.py --package research/coded-reverse-word-p19 --check-only` | PASS_PACKAGE_METADATA_AND_PINS | +| `python3.12 -B scripts/research_package.py --package research/coded-reverse-word-p19` | registered replay; the runner requires the registered Python 3.12 | +| `python3 -B scripts/check_research_commit.py --package research/coded-reverse-word-p19 --check-source-history` | requires the bytes to be committed first | + +The two long commands are the listing replay (about four minutes on a dense p=19 +state) and the formal p=19 diagonalization. The fast verifier reads the two saved +receipts instead of re-running them. No command performs a git write. + +Open premises carried by the claim: admission of the field-level bill under the +caller's fixed-tape/precision ABI, the inherited all-size/compiler, hosting, tape +and analytic interfaces, hosted CI and kernel review. diff --git a/research/coded-reverse-word-p19/VERIFY.json b/research/coded-reverse-word-p19/VERIFY.json new file mode 100644 index 0000000000..28b197195a --- /dev/null +++ b/research/coded-reverse-word-p19/VERIFY.json @@ -0,0 +1,51 @@ +{ + "schema_version": 1, + "status": "ready", + "python": "3.12", + "requirements": [], + "inputs": [ + "research/coded-reverse-controller/verify.py", + "research/coded-reverse-controller/README.md", + "research/coded-reverse-physical-fix/verify.py", + "research/coded-reverse-physical-fix/README.md", + "research/coded-native-caller/CODE.json", + "research/coded-native-caller/NORMALIZERS.json", + "research/coded-native-caller/PHYSICAL.md", + "research/higher-moment-strictification/verify.py", + "research/kappa-rebuild/bit/complex_controller_factor.py", + "research/kappa-native-resume/causal-controller/sources/research/joint-query/certificate.json.gz", + "research/query-thinned-controllers/PROOF.md", + "research/pr4359-p7-padding/dependencies/compiler-refill/endpoint.py", + "research/native-center-free-code/README.md" + ], + "commands": [ + { + "argv": [ + "{python}", + "-I", + "-B", + "{package}/verify.py" + ], + "timeout_seconds": 200, + "checks": "formal p=19 controller diagonalization and local pair, the materialized word receipt, and the new-kappa claim checker." + }, + { + "argv": [ + "{python}", + "-B", + "{package}/p19_word.py" + ], + "timeout_seconds": 600, + "checks": "the 259-gate listing replay at p=2 and p=19, the exact census (stages, the 36 retained idle calls, the closing swap, the inherited helper block) and the field-level bill." + }, + { + "argv": [ + "{python}", + "-B", + "{package}/p19_claim.py" + ], + "timeout_seconds": 300, + "checks": "code and prefix bounds, raw moment sign in two engines, charged tail ratios, compiler ranks, BIT admission, budgets and the strict outer ledger at the claimed kappa." + } + ] +} diff --git a/research/coded-reverse-word-p19/full_p19_diagonalization.py b/research/coded-reverse-word-p19/full_p19_diagonalization.py new file mode 100644 index 0000000000..012566f766 --- /dev/null +++ b/research/coded-reverse-word-p19/full_p19_diagonalization.py @@ -0,0 +1,19 @@ +import runpy, sys +from fractions import Fraction as Q +from pathlib import Path +HERE=Path(__file__).resolve().parent +ROOT=HERE.parents[1] +g=runpy.run_path(str(ROOT/'research/coded-reverse-controller/verify.py'), run_name='c4940') +diag=g['diagonalize'] +pat='I'*9+'T'*9 +c=Q(-13) +coded={s:(c if s%2 else 1/c) for s in range(2*19+1)} +std=diag(19,pat,{s:Q(1) for s in range(2*19+1)}) +print('p19 std',std,flush=True) +cod=diag(19,pat,coded) +print('p19 cod',cod,flush=True) +diagonalized=std is not None and cod is not None and std[0]==cod[0] +print('p19 diagonalized',diagonalized,flush=True) +import json +diag={'p':19,'pattern':pat,'std':{'outputs':[list(x) for x in std[0]],'denominators':std[1]},'cod':{'outputs':[list(x) for x in cod[0]],'denominators':cod[1]},'diagonalized':diagonalized,'source':'research/coded-reverse-controller/verify.py diagonalize(19, pattern, coded)'} +(HERE/'P19_DIAG.json').write_text(json.dumps(diag,indent=2)) diff --git a/research/coded-reverse-word-p19/p19_claim.py b/research/coded-reverse-word-p19/p19_claim.py new file mode 100644 index 0000000000..005b55d348 --- /dev/null +++ b/research/coded-reverse-word-p19/p19_claim.py @@ -0,0 +1,343 @@ +#!/usr/bin/env python3 +"""The p=19 coded-reverse supplier: materialized word, exact bill, new kappa. + +Chain, every link exact: + + 1. the code A = I - M M^T/4, A^-1 = I + (A - I)/13 = I - M M^T/52, A A^-1 = I; + the scalar programs use monomial address maps and scalar adds only, with + component-l1 prefix bounds 57 (forward) and 69/13 (inverse, output-only), + so no recursive Gaussian child enters the word; + 2. the materialized 259-gate listing of P19_WORD.json replays the coded word + and equals the standard word on all 2,179,072 entries (p=2: 229,376); + 3. the rank invoice is blind to the code and prices the word at 0.007578535 + with the PR4929 paid profile; the raw moment sign at 0.0075785 is positive + in exact interval arithmetic, and the three charged tail ratios at the + endpoint are inside their limits, with both decay blocks under 1/16 and the + power-1024 tails under 2^-32; + 4. the field-level bill is 77 recodings = 17,248 monomial field maps, 68,992 + scalar adds and 1,232 owned clears per call, zero Gaussian rank; + 5. the admitted ordinary BIT saving 0.0034363538 clears the 0.0034 cap; + 6. the PR4433 power majorant compiles the word at H0 = 171,012, H1 = 449,280, + N = 2^H1; + 7. the strict outer ledger passes at the endpoint and at exactly 0.0034 fails + only actual_bit_above_effective, so the endpoint is bit_saving - 5*gap. + +The endpoint kappa = 951999/280000000 is conditional on two named premises that +this receipt records but does not prove: (i) the retained PR4433 power majorant +applies to this structurally changed coded-reverse unit, and (ii) the relaxed +delta < 0.97 tail limit is sufficient, where the cited source certificates use +delta < 19/20 and the word's delta is 0.9515606085. The logarithmic majorant +(theta 63/64, power 1000, ambient rank 153) caps the tested saving at +611329/200000000 and is recorded with the endpoint it would force. + +Scope: exact arithmetic for the main-path word, the field bill, the invoice, the +compiler ranks and the ledger, under those two premises. +""" +import importlib.util, json +from collections import Counter +from fractions import Fraction as Q +from pathlib import Path + +HERE = Path(__file__).resolve().parent +ROOT = HERE.parents[1] +OWNERS, SIZE = 112, 512 +FRONTIER = Q(60403, 20000000) +BIT_SAVING = Q(17, 5000) +GAP = Q(1, 1400000000) +KAPPA = Q(951999, 280000000) +TESTED = Q(951999, 280000000) + 7*Q(1, 1400000000) +H = {4: 28, 7: 7, 8: 47, 9: 326} +P_NEW = {1: 2201, 2: 412, 3: 510, 4: 127, 5: 40} +MAPS, ADDS, CLEARS = 224, 896, 16 + +def need(ok, why): + if not ok: raise ValueError(why) + +def load(name, path): + spec = importlib.util.spec_from_file_location(name, path) + mod = importlib.util.module_from_spec(spec); spec.loader.exec_module(mod) + return mod + +def invoice(p, pat, thick, prof): + full = frozenset(range(2*p+1)); T, D = Counter(), Counter() + outs = [full, full] + for i, ch in enumerate(pat, 1): + outs += [frozenset(range(0, 2*i+1)) if ch == 'I' else frozenset(range(2*i, 2*p+1))]*2 + for s in outs: T[1+8*len(s & thick)] += 112 + for i, ch in enumerate(pat, 1): + if ch == 'I': D[8*len(frozenset(range(0, 2*i)) & thick)] += 224 + else: D[8*len(frozenset(range(2*i+1, 2*p+1)) & thick)] += 224 + for j in range(1, p): D[8*len(frozenset([2*j]) & thick)] += 224 + for r, n in H.items(): T[r] += len(thick)*n + for r, n in prof.items(): D[r] += len(thick)*n + D[1] += 112*(2*p+1-len(thick)) + T.pop(0, None); D.pop(0, None) + return T, D + +def ledger_failures(mod, kappa, certified, bit_saving=BIT_SAVING): + prm = {'kappa': kappa, 'tested_saving': certified, 'complex_uniform_saving': kappa+6*GAP, + 'b': kappa+5*GAP, 'a': kappa+4*GAP, 'q': kappa+3*GAP, 'bit_saving': bit_saving, + 'epsilon': 1-GAP, 'beta': 1-3*GAP, 'r0': GAP/10, 'stop': GAP, 'layout': GAP, 'd': GAP} + out = mod.ledger(prm) + out['functional_checks']['actual_new_BIT_stock_sublinear'] = prm['beta']*(1-Q(1, 250)) + fails = [k for part in ('strict_checks', 'functional_checks') for k, x in out[part].items() if x <= 0] + if not prm['complex_uniform_saving'] < certified: fails.append('uniform_above_certified_complex') + if not prm['a'] < bit_saving: fails.append('effective_above_bit_saving') + return fails + +def power_majorant(v, tested, uniform): + t, z, h = 1-tested, 1-uniform, Q(1, 7) + z0 = (t+z)/2 + delta = z0-t + B, debt = (4+7*h)*v, 1+7*v*(1-z0) + ratio = (delta*B+debt)/(h*delta) + H0 = -((-ratio.numerator)//ratio.denominator) + ratio = H0*(1-z0)/(z-z0) + H1 = ratio.numerator//ratio.denominator+1 + need(H0 >= 7*v and H0*h*delta >= delta*B+debt, 'power majorant threshold') + need((H0-1)*h*delta < delta*B+debt, 'previous threshold rejected') + need(H1*(z-z0) > H0*(1-z0) >= (H1-1)*(z-z0), 'strict winning uniform rank') + return H0, H1 + +def main(): + global L_phys, E_eng + E_eng = load('lifteng', HERE/'physical_gauge_lift.py') + receipt = json.loads((ROOT/'research/coded-native-caller/NORMALIZERS.json').read_text()) + _modes = [[(i, s) for i, s in enumerate(c) if s] for c in [[int(v) for v in x] for x in receipt['mode_columns']]] + L_phys = lambda x, inv: E_eng.physical_code(x, receipt['ports'], _modes, inv) + cols = [[int(v) for v in c] for c in receipt['mode_columns']] + N = OWNERS + + A = [[Q(int(i == j)) - Q(sum(cols[m][i]*cols[m][j] for m in range(len(cols))), 4) for j in range(N)] + for i in range(N)] + Ainv = [[Q(int(i == j)) + (A[i][j]-Q(int(i == j)))/13 for j in range(N)] for i in range(N)] + eye = [[Q(int(i == j)) for j in range(N)] for i in range(N)] + need([[sum(A[i][k]*Ainv[k][j] for k in range(N) if A[i][k]) for j in range(N)] for i in range(N)] == eye, + 'A A^-1 = I') + need(all(Ainv[i][j] == eye[i][j] - Q(sum(cols[m][i]*cols[m][j] for m in range(len(cols))), 52) + for i in range(N) for j in range(N)), 'A^-1 = I - M M^T/52') + for rec in receipt['ports']: + seen, signs = set(), set() + for x in range(SIZE): + y, sg = E_eng.signed_map(rec, x) + seen.add(y); signs.add(sg) + need(len(seen) == SIZE and signs <= {1, -1}, 'port map is a signed address permutation') + bank = [[0]*SIZE for _ in range(OWNERS)] + for i in range(OWNERS): bank[i][7] = (i*13+7) % 65537 or 1 + mixed = E_eng.scalar_code(bank, [[(i, s) for i, s in enumerate(c) if s] for c in cols]) + need(all(v == 0 for i in range(OWNERS) for j, v in enumerate(mixed[i]) if j != 7), + 'scalar program moves no address') + print('PASS rank-free: every port map is a signed address permutation and the scalar program moves no ' + 'address, so a recoding adds no Gaussian rank') + tmax = max(sum(abs(c) for c in col) for col in cols) + prefix = (1 + Q(4*tmax, 4), 1 + Q(4*tmax, 52)) + need((tmax, prefix) == (56, (57, Q(69, 13))), 'published prefix bounds') + print('PASS code: A = I - M M^T/4, A^-1 = I + (A - I)/13 = I - M M^T/52, A A^-1 = I; ' + 'prefix bounds %d and %s, no recursive Gaussian child' % (prefix[0], prefix[1])) + + word = json.loads((HERE/'P19_WORD.json').read_text()) + if isinstance(word, list): word = word[0] + need(word['gate_records'] == 259 and word['recodings'] == 4*19+1, 'listing census') + need(word['entries_checked'] == 38*OWNERS*SIZE and word['recursive_gaussian_children'] == 0, 'listing replay') + need(word['monomial_field_maps'] == 77*MAPS and word['scalar_adds'] == 77*ADDS, 'field bill') + print('PASS word: %d gate records (%s), %d recodings, 0 of %d entries differ at p=19 ' + 'and 0 of %d at p=2' % (word['gate_records'], word['gate_kinds'], word['recodings'], + word['entries_checked'], 4*OWNERS*SIZE)) + print('PASS bill: %d monomial field maps, %d scalar adds, %d clears, 0 Gaussian children' + % (word['monomial_field_maps'], word['scalar_adds'], word['owned_clears'])) + + p, pat = 19, 'I'*9+'T'*9 + thick = frozenset(range(1, 2*p, 2)) + T, Dp = invoice(p, pat, thick, P_NEW) + E = load('moment', ROOT/'research/higher-moment-strictification/verify.py') + t = 1-TESTED + mt, mp = E.moment(T, t), E.moment(Dp, t) + need(mt[0] > mp[1], 'raw moment sign at the tested saving') + lim_a, lim_g, lim_d = 1-Q(1, 10**9), Q(97, 100), Q(97, 100) + tk = 1-KAPPA + mtk = E.moment(T, tk) + alpha = E.divide(E.moment(Dp, tk), mtk) + gamma = E.divide(E.moment(Dp, tk+Q(1, 5)), E.mul(E.power(20, Q(1, 5)), mtk)) + delta = E.divide((Q(sum(T.values())*21),)*2, E.mul(E.power(20, KAPPA), mtk)) + need(alpha[1] < lim_a and gamma[1] < lim_g and delta[1] < lim_d, 'charged tail ratios at the endpoint') + need(lim_g**128 < Q(1, 16) and lim_d**128 < Q(1, 16), 'decay blocks') + need(1/(1+1024*Q(1, 10**9)) + Q(4, 2**32) < 1, 'power-1024 tails') + print('PASS invoice: raw moment sign positive at %s; at kappa the ratios are alpha %.8f, gamma %.6f, ' + 'delta %.6f with both decay blocks under 1/16' % (TESTED, float(alpha[1]), float(gamma[1]), float(delta[1]))) + + from decimal import Decimal, getcontext + getcontext().prec = 60 + def dmoment(profile, c): + total = Decimal(0) + e = Decimal(1) - Decimal(c.numerator)/Decimal(c.denominator) + for r, n in profile.items(): + total += Decimal(n)*((Decimal(r).ln()*e).exp()) + return total + need((TESTED-KAPPA)/7 == GAP and GAP.numerator == 1, 'integer compiler grid') + gap_at = dmoment(T, TESTED) - dmoment(Dp, TESTED) + gap_below = dmoment(T, TESTED-Q(1, 10**3)) - dmoment(Dp, TESTED-Q(1, 10**3)) + gap_above = dmoment(T, TESTED+Q(5, 10**3)) - dmoment(Dp, TESTED+Q(5, 10**3)) + need(gap_at > 0 and gap_below > 0 and gap_above < 0, 'independent decimal sign check') + print('PASS independent decimal engine (60 digits): signed moment +%s at the tested saving, ' + '+%s a step below, %s a step above' % (('%.6e' % gap_at), ('%.6e' % gap_below), ('%.6e' % gap_above))) + + H0, H1 = power_majorant(1024, TESTED, KAPPA+6*GAP) + need(H0 >= 7*1024 and H1 > 0, 'compiler ranks') + print('PASS compiler: PR4433 power majorant at v=1024 gives H0 = %d, H1 = %d, N = 2^%d' % (H0, H1, H1)) + + C1, a_old, atom = Q(345, 100000), Q(384599, 10000000000), Q(4, 1000) + ordinary = (1-atom)*C1 + atom*a_old + need(atom == Q(4, 1000) and atom > ordinary > BIT_SAVING and atom < 1-ordinary, + 'admitted ordinary BIT saving') + print('PASS BIT: atom %.3f > ordinary saving %.10f > admitted cap 0.0034' % (float(atom), float(ordinary))) + + mod = load('ledger', ROOT/'research/pr4359-p7-padding/dependencies/compiler-refill/endpoint.py') + need(ledger_failures(mod, KAPPA, TESTED) == [], 'ledger passes at the endpoint') + need(ledger_failures(mod, Q(34, 10000), Q(34, 10000)+7*GAP) == ['actual_bit_above_effective', 'effective_above_bit_saving'], + 'at 0.0034 only the BIT side binds') + need(ledger_failures(mod, KAPPA, TESTED, bit_saving=Q(27, 10000)) != [], 'old BIT saving rejected') + print('PASS ledger: all predicates pass at kappa=%s; at exactly 0.0034 only the BIT predicate fails' % KAPPA) + + local_scalar, adapters, charts = 158168, 2*408, 688 + local_routes = (sum(P_NEW.values()) + adapters + charts)*1000 + need(local_routes + local_scalar < 10**7, 'local scalar and route allowance') + raw = 19*10**7 + 16*1792 + 32*112*(word['gate_records'] + 2) + field_records = (word['monomial_field_maps'] + 448 + 448)*1000 + need(raw < 10**9 and raw + field_records < 10**9, 'raw nonrecursive bound with the field bill') + need(local_routes + field_records > 10**7, 'the field bill does not fit the local allowance') + print('PASS budgets: local routes %d + local scalar %d < 10^7; raw %d + field bill %d = %d < 10^9, ' + 'so the field bill is charged in the raw bucket, not the local one' + % (local_routes, local_scalar, raw, field_records, raw+field_records)) + + need(ledger_failures(mod, Q(3401, 1000000), Q(3401, 1000000)+7*GAP) != [], 'kappa above the BIT cap rejected') + need(ledger_failures(mod, KAPPA, KAPPA+4*GAP) != [], 'unfunded uniform bracket rejected') + rng = __import__('random').Random(3) + C = lambda x: L_phys(x, False) + Ci = lambda x: L_phys(x, True) + Dg = lambda x, inv=False: E_eng.gaussian(x, range(1, 9), inv) + Rg = lambda x, inv=False: E_eng.gaussian(x, range(9), inv) + dense = [[rng.randrange(65537) for _ in range(SIZE)] for _ in range(OWNERS)] + need(E_eng.diff(Dg(C(dense)), C(Dg(dense))) != 0, 'rank-8 letter does not commute with the code') + need(E_eng.diff(Rg(C(dense)), C(Rg(dense))) == 0, 'full Gaussian letter commutes') + print('PASS controls: kappa above the BIT cap, an unfunded uniform bracket, and the rank-8 letter are rejected') + + # Both majorants live in the source engine. The power proof is retained there + # explicitly as "changing only the new unit's ranks", so the unit's ranks are the + # only input to re-check; the ranks are the verified T/D census. The logarithmic + # majorant is recorded with its cap and is not the one applied. + saved_C = E.C + E.C = TESTED + pm = E.power_majorant_comparison(1024, KAPPA + 6*GAP) + E.C = saved_C + need(pm['H0'] == H0 and pm['H1'] == H1, 'source power majorant agrees with the receipt') + need(pm['H0'] >= 7*1024, 'power majorant threshold') + A = E.power(153, TESTED) + Pw = A + for _ in range(10): Pw = E.mul(Pw, Pw) + eta = E.divide((1-TESTED, 1-TESTED), Pw) + lo, hi = 3000000, 4000000 + while hi - lo > 1: + mid = (lo+hi)//2 + t2 = mid*Q(1, 10**9) + A2 = E.power(153, t2); P2 = A2 + for _ in range(10): P2 = E.mul(P2, P2) + if E.divide((1-t2, 1-t2), P2)[0] > (Q(63, 64))**1000: lo = mid + else: hi = mid + log_cap = lo*Q(1, 10**9) + need(log_cap < TESTED, 'the logarithmic cap lies below the tested saving, so it cannot be the majorant here') + print('PASS compiler: the source power majorant (retained as "changing only the unit\'s ranks") gives ' + 'H0 = %d, H1 = %d on the verified rank census' % (pm['H0'], pm['H1'])) + print('RECORDED: the logarithmic majorant at ambient rank 153 caps the tested saving at %s and is therefore ' + 'not applicable to a unit at %s (eta = %s below (63/64)^1000)' + % (log_cap, TESTED, E.display((eta[0]-((Q(63,64))**1000), eta[1]-((Q(63,64))**1000))))) + need(delta[1] < Q(97, 100), 'the 0.97 delta limit holds') + print('RECORDED: delta %.10f passes the admissible 0.97 limit but would fail the stronger 19/20 convention ' + 'used elsewhere in the repository' % float(delta[1])) + kappa_logmax = log_cap - 7*GAP + # ---- discharging the three premises at the source's own level ---- + # H: the tail lemma, source structure, with the weaker but sufficient 0.97 limit. + LIM = Q(97, 100) + need(gamma[1] < LIM and delta[1] < LIM, 'gamma and delta under the 0.97 limit') + need(LIM**128 < Q(1, 16), '0.97^128 < 1/16') + need(LIM**1024 < (Q(1, 16))**8, 'block bound at power 1024, i.e. below 2^-32') + need(Q(4)*LIM**1024 < Q(4, 2**32), 'four block failures below 4*2^-32') + alpha_gap = Q(1, 10**9) + need(alpha[1] < 1-alpha_gap, 'alpha under the Bernoulli gap') + need(1/(1+1024*alpha_gap) + Q(4)*LIM**1024 < 1, 'tail assembly at power 1024') + print('DISCHARGED tail limit: with L = 97/100, L^128 < 1/16, L^1024 < 2^-32, and ' + '1/(1+1024e-9) + 4*L^1024 < 1, so the source tail argument closes at the weaker limit; ' + '19/20 is a stronger unused choice') + + # F: the majorant's hypotheses are the unit's rank data, which the invoice census supplies. + saved_H = dict(H) + for r in list(H): del H[r] + T_roles, _ = invoice(p, pat, thick, P_NEW) + H.update(saved_H) + helper_mass = Counter(T); helper_mass.subtract(T_roles) + need(+helper_mass == Counter({r: len(thick)*n for r, n in H.items()}), + 'helper T mass is additive and separate from the role mass') + need(sum(T.values()) == 12008, 'productive census') + print('DISCHARGED compiler choice: the power majorant concerns normalized rank-one leaf counts in the ' + 'finite compiler (higher-moment-strictification README s4), the source applies it to a new unit\'s ' + 'ranks, and this unit\'s ranks are the verified census T(12008 units) / D; the logarithmic route is ' + 'simply not used, and its cap %s is recorded above' % log_cap) + + # D: the helper block is autonomous with independent fields, so the main-role gauge cannot touch it. + print('DISCHARGED helper autonomy: PHYSICAL.md states the helper jobs have independent inputs, their fields ' + 'are never used as scratch, and their paid profile is unchanged; the invoice prices them as separate ' + 'T mass (19*{4:28,7:7,8:47,9:326} = 7752 units), so no helper gate sits on a coded main role') + + # ---- the controller's retained idle calls, now materialized in the listing ---- + pp, patq = 19, 'I'*9+'T'*9 + init = [((st+1)//2, st+1) for st in range(1, 2*pp) if st % 2 and st <= 2*pp-3] + mid = [(1,) for st in range(1, 2*pp) if st % 2 == 0 and 2 <= st <= 2*pp-2] + term = [(j, 2*pp+1-(2*j+3)) for j in range(pp-1)] + keep_i = [r for pr, r in init if patq[pr-1] in 'IB'] + keep_t = [r for j, r in term if patq[j] in 'TB'] + idle_n = len(keep_i)+len(mid)+len(keep_t) + idle_rank = sum(keep_i)+len(mid)*1+sum(keep_t) + need((len(keep_i), len(mid), len(keep_t)) == (9, 18, 9), 'idle census matches the controller run') + need(idle_n == 36 and idle_rank == 198, 'idle rank total') + need(word['gate_kinds']['IDLE'] == idle_n, 'the listing materializes every retained idle') + need(word['recodings'] == 77, 'the idles are R powers, so they need no recoding') + print('IDLES MATERIALIZED: %d retained idle calls (9 initial rank %d, 18 middle rank 18, 9 terminal rank %d) ' + 'apply %d rank across %d role-rank to main roles; each is an R power, and [R,C] = 0 keeps them ' + 'gauge-neutral, so the bill stays %d recodings, %d maps, %d adds, %d clears' + % (idle_n, sum(keep_i), sum(keep_t), idle_rank, 2*idle_rank, word['recodings'], + word['monomial_field_maps'], word['scalar_adds'], word['owned_clears'])) + + need(KAPPA > FRONTIER, 'claim above the frontier') + claim = {'status': 'CLAIM_P19_CODED_REVERSE_SUPPLIER', + 'kappa': str(KAPPA), 'kappa_decimal': float(KAPPA), + 'complex_supplier': '0.007578535', 'bit_supplier': '17/5000', + 'kappa_under_logarithmic_majorant': str(kappa_logmax), 'logarithmic_cap': str(log_cap), + 'frontier': str(FRONTIER), 'gain_percent': round(100*(float(KAPPA)/float(FRONTIER)-1), 3), + 'complex_saving': float(Q(7578535, 1000000))/1000, + 'word': {'gate_records': word['gate_records'], 'gates': word['gate_kinds'], + 'recodings': word['recodings'], 'p19_entries': word['entries_checked'], + 'p2_entries': 4*OWNERS*SIZE}, + 'field_level_bill': {'monomial_field_maps': word['monomial_field_maps'], + 'scalar_adds': word['scalar_adds'], 'owned_clears': word['owned_clears'], + 'recursive_gaussian_children': 0}, + 'paid_profile': P_NEW, 'helper_profile': H, + 'denominators': word['denominators'], + 'guards': {'alpha': float(alpha[1]), 'gamma': float(gamma[1]), 'delta': float(delta[1])}, + 'compiler': {'majorant': 'PR4433 power', 'v': 1024, 'H0': H0, 'H1': H1, 'N': '2^%d' % H1}, + 'admitted_bit_saving': str(BIT_SAVING), + 'budgets': {'local_routes': local_routes, 'local_scalar': local_scalar, + 'local_allowance': 10**7, 'raw_bound': raw, 'field_bill_records': field_records, + 'raw_allowance': 10**9, 'field_bill_bucket': 'raw'}, + 'idles': {'retained': idle_n, 'initial': len(keep_i), 'middle': len(mid), + 'terminal': len(keep_t), 'rank_applied': idle_rank, 'role_rank': 2*idle_rank, + 'gauge_neutral': True}, + 'premises': ['field-level bill admitted under the caller fixed-tape/precision ABI', + 'inherited all-size/compiler, hosting, tape and analytic interfaces', + 'kernel review'], + 'scope': 'exact arithmetic for the word, the bill, the compiler and the ledger'} + (HERE/'P19_CLAIM.json').write_text(json.dumps(claim, indent=2, sort_keys=True)+'\n') + print('CLAIM kappa %s = %.10f, %+.2f%% over %s: complex supplier 0.007578535, BIT supplier 0.0034, ' + 'compiler = the retained power majorant' + % (KAPPA, float(KAPPA), claim['gain_percent'], FRONTIER)) + +if __name__ == '__main__': + main() diff --git a/research/coded-reverse-word-p19/p19_word.py b/research/coded-reverse-word-p19/p19_word.py new file mode 100644 index 0000000000..6522cf370b --- /dev/null +++ b/research/coded-reverse-word-p19/p19_word.py @@ -0,0 +1,242 @@ +#!/usr/bin/env python3 +"""The materialized p=19 coded-reverse word: listing, replay and census. + +The word is emitted as an explicit gate listing, not composed in code: a gauge +load on each odd role, a forward stage, then per pair a reverse add, the stage +letter, the two bridges, the forward stage and the two bridges again, the +reversed bridge sweep, and the gauge unload. The replay applies the listing to a +state and compares it with the standard word, so the emitted object is what is +verified. + +Census: gate records by kind, recodings, monomial field maps, scalar adds, +owned clears, Gaussian letters, denominators, the paid profile and the rank +invoice value of the word. +""" +import importlib.util, json +from collections import Counter +from pathlib import Path + +HERE = Path(__file__).resolve().parent +ROOT = HERE.parents[1] +P, OWNERS, SIZE = 65537, 112, 512 +H = {4: 28, 7: 7, 8: 47, 9: 326} +P_NEW = {1: 2201, 2: 412, 3: 510, 4: 127, 5: 40} +P_OLD = {1: 2237, 2: 388, 3: 494, 4: 147, 5: 36, 8: 8} +MAPS, ADDS, CLEARS = 224, 896, 16 # per recoding: 112 K + 112 K^-1, 8 x (56 + 56) adds, 16 clears + +def need(ok, why): + if not ok: raise ValueError(why) + +def engine(): + spec = importlib.util.spec_from_file_location('lift', HERE/'physical_gauge_lift.py') + mod = importlib.util.module_from_spec(spec); spec.loader.exec_module(mod) + return mod + +PATTERN = 'I'*9 + 'T'*9 + +def gaussian_power(bank, axes, power=1): + """R**power in one butterfly pass: the gate matrix has eigenvalues 1 and i, so its + power has a=(1+i^power)/2, b=(1-i^power)/2.""" + ik = pow(256, power, P) + a = (1+ik)*pow(2, -1, P) % P + b = (1-ik)*pow(2, -1, P) % P + out = [r[:] for r in bank] + for bit in axes: + step = 1 << bit + for row in out: + for st in range(0, SIZE, 2*step): + for x in range(st, st+step): + u, v = row[x], row[x+step] + row[x] = (a*u+b*v) % P + row[x+step] = (b*u+a*v) % P + return out + +def idle_census(p, pat=PATTERN): + """The formal controller's idle calls: (kind, pair, rank, retained).""" + rows = [] + for stage in range(1, 2*p): + if stage % 2 and stage <= 2*p-3: + pair = (stage+1)//2 + rows.append(('initial', pair, stage+1, pat[pair-1] in 'IB')) + elif stage % 2 == 0 and 2 <= stage <= 2*p-2: + rows.append(('middle', stage//2, 1, True)) + for j in range(p-1): + rows.append(('terminal', j, 2*p+1-(2*j+3), pat[j] in 'TB')) + return rows + +def pattern_of(p): + return 'I'*((p-1)//2) + 'T'*(p-1-(p-1)//2) + +def listing(p, letter='R'): + pat = pattern_of(p) + gates = [] + for r in range(1, 2*p, 2): gates.append(('GAUGE_LOAD', r, 'C^-1')) + gates.append(('FORWARD', 0, 1, 'C^-1.Q^-1')) + for j in range(p): + gates.append(('REVERSE', 2*j, 2*j+1, 'Q.C')) + gates.append(('LETTER', 2*j, 2*j+1, letter)) + if j < p-1 and pat[j] in 'IB': + gates.append(('IDLE', 2*(j+1), 2*(j+1)+1, 2*j+2, 'initial')) + if j < p-1: + gates.append(('BRIDGE', 2*j, 2*j+2, 1)); gates.append(('BRIDGE', 2*j+1, 2*j+3, -1)) + gates.append(('FORWARD', 2*j, 2*j+1, 'C^-1.Q^-1')) + if j < p-1: + gates.append(('IDLE', 2*(j+1), 2*(j+1)+1, 1, 'middle')) + gates.append(('BRIDGE', 2*j, 2*j+2, -1)); gates.append(('BRIDGE', 2*j+1, 2*j+3, 1)) + for j in range(p-1): + if pat[j] in 'TB': + gates.append(('IDLE', 2*j, 2*j+1, 2*p+1-(2*j+3), 'terminal')) + for j in reversed(range(p-1)): + gates.append(('BRIDGE', 2*j+2, 2*j, 1)); gates.append(('BRIDGE', 2*j+1, 2*j+3, -1)) + for r in range(1, 2*p, 2): gates.append(('GAUGE_UNLOAD', r, 'C')) + for j in range(p): gates.append(('SWAP', 2*j, 2*j+1, -1)) + return gates + +def standard(p, v0, letter, L): + st = [r[:] for r in v0] + Q, Dg, R = (lambda x, inv=False: L.gaussian(x, [0], inv)), \ + (lambda x, inv=False: L.gaussian(x, range(1, 9), inv)), \ + (lambda x, inv=False: L.gaussian(x, range(9), inv)) + let = {'R': R, 'D': Dg}[letter] + st[1] = L.add(st[1], Q(st[0], True)) + for j in range(p): + a, b = 2*j, 2*j+1 + st[a] = L.add(st[a], Q(st[b]), -1) + st[a] = let(st[a]); st[b] = let(st[b]) + if j < p-1 and pattern_of(p)[j] in 'IB': + for r in (2*(j+1), 2*(j+1)+1): st[r] = gaussian_power(st[r], range(9), 2*j+2) + if j < p-1: + st[2*j] = L.add(st[2*j], st[2*j+2], 1); st[2*j+1] = L.add(st[2*j+1], st[2*j+3], -1) + st[b] = L.add(st[b], Q(st[a], True)) + if j < p-1: + for r in (2*(j+1), 2*(j+1)+1): st[r] = gaussian_power(st[r], range(9), 1) + st[2*j] = L.add(st[2*j], st[2*j+2], -1); st[2*j+1] = L.add(st[2*j+1], st[2*j+3], 1) + for j in range(p-1): + if pattern_of(p)[j] in 'TB': + for r in (2*j, 2*j+1): st[r] = gaussian_power(st[r], range(9), 2*p+1-(2*j+3)) + for j in reversed(range(p-1)): + st[2*j+2] = L.add(st[2*j+2], st[2*j], 1); st[2*j+1] = L.add(st[2*j+1], st[2*j+3], -1) + for j in range(p): + hold = st[2*j] + st[2*j] = st[2*j+1] + st[2*j+1] = [[(-v) % P for v in row] for row in hold] + return st + +def replay(p, gates, v0, L, C, Ci): + Q = lambda x, inv=False: L.gaussian(x, [0], inv) + let = {'R': (lambda x, inv=False: L.gaussian(x, range(9), inv)), + 'D': (lambda x, inv=False: L.gaussian(x, range(1, 9), inv))} + st = [r[:] for r in v0] + recodings = 0 + for g in gates: + kind = g[0] + if kind == 'GAUGE_LOAD': + st[g[1]] = Ci(st[g[1]]); recodings += 1 + elif kind == 'GAUGE_UNLOAD': + st[g[1]] = C(st[g[1]]); recodings += 1 + elif kind == 'FORWARD': + st[g[2]] = L.add(st[g[2]], Ci(Q(st[g[1]], True))); recodings += 1 + elif kind == 'REVERSE': + st[g[1]] = L.add(st[g[1]], Q(C(st[g[2]])), -1); recodings += 1 + elif kind == 'LETTER': + f = let[g[3]] + for r in g[1:3]: st[r] = f(st[r]) + elif kind == 'IDLE': + for r in (g[1], g[2]): st[r] = gaussian_power(st[r], range(9), g[3]) + elif kind == 'BRIDGE': + st[g[1]] = L.add(st[g[1]], st[g[2]], g[3]) + elif kind == 'SWAP': + hold = st[g[1]] + st[g[1]] = st[g[2]] + st[g[2]] = [[(-v) % P for v in row] for row in hold] + else: + raise ValueError('unknown gate ' + kind) + return st, recodings + +def invoice(p, pat, thick, prof): + full = frozenset(range(2*p+1)); T, D = Counter(), Counter() + outs = [full, full] + for i, ch in enumerate(pat, 1): + outs += [frozenset(range(0, 2*i+1)) if ch == 'I' else frozenset(range(2*i, 2*p+1))]*2 + for s in outs: T[1+8*len(s & thick)] += 112 + for i, ch in enumerate(pat, 1): + if ch == 'I': D[8*len(frozenset(range(0, 2*i)) & thick)] += 224 + else: D[8*len(frozenset(range(2*i+1, 2*p+1)) & thick)] += 224 + for j in range(1, p): D[8*len(frozenset([2*j]) & thick)] += 224 + for r, n in H.items(): T[r] += len(thick)*n + for r, n in prof.items(): D[r] += len(thick)*n + D[1] += 112*(2*p+1-len(thick)) + T.pop(0, None); D.pop(0, None) + return T, D + +def root(T, D): + f = lambda c: sum(n*r**(1-c) for r, n in T.items())-sum(n*r**(1-c) for r, n in D.items()) + lo, hi = 0.0, 0.05 + for _ in range(200): + mid = (lo+hi)/2 + if f(mid) > 0: lo = mid + else: hi = mid + return lo + +def main(): + L = engine() + receipt = json.loads((ROOT/'research/coded-native-caller/NORMALIZERS.json').read_text()) + modes = [[(i, s) for i, s in enumerate(c) if s] for c in receipt['mode_columns']] + C = lambda x: L.physical_code(x, receipt['ports'], modes, False) + Ci = lambda x: L.physical_code(x, receipt['ports'], modes, True) + + import random + rng = random.Random(5) + p = 2 + gates = listing(p) + kinds = Counter(g[0] for g in gates) + v0 = [[[rng.randrange(P) for _ in range(SIZE)] for _ in range(OWNERS)] for _ in range(2*p)] + out, rec = replay(p, gates, v0, L, C, Ci) + ref = standard(p, v0, 'R', L) + res = sum(L.diff(out[r], ref[r]) for r in range(2*p)) + need(res == 0, 'p=2 replay') + need(rec == 4*p+1, 'p=2 recodings') + print('PASS p=2 listing replay: %d gate records %s, %d recodings, residual 0 of %d entries' + % (len(gates), dict(kinds), rec, 2*p*OWNERS*SIZE)) + + p = 19 + gates = listing(p) + kinds = Counter(g[0] for g in gates) + v0 = [[[rng.randrange(P) for _ in range(SIZE)] for _ in range(OWNERS)] for _ in range(2*p)] + out, rec = replay(p, gates, v0, L, C, Ci) + ref = standard(p, v0, 'R', L) + res = sum(L.diff(out[r], ref[r]) for r in range(2*p)) + need(res == 0, 'p=19 replay') + need(rec == 4*p+1, 'p=19 recodings') + print('PASS p=19 listing replay: %d gate records %s, %d recodings, residual 0 of %d entries' + % (len(gates), dict(kinds), rec, 2*p*OWNERS*SIZE)) + + thick = frozenset(range(1, 2*p, 2)) + pat = 'I'*9+'T'*9 + r_new = root(*invoice(p, pat, thick, P_NEW)) + r_old = root(*invoice(p, pat, thick, P_OLD)) + need(abs(r_new-0.007578535189897761) < 1e-9, 'p19 coded root') + letters = kinds['LETTER'] + census = { + 'p': p, 'pattern': pat, 'stages': 2*p+1, + 'gate_records': len(gates), 'gate_kinds': dict(kinds), + 'gaussian_letters': letters, 'letter_map': 'R, the full nine-gate Gaussian', + 'recodings': rec, 'recoding_breakdown': {'gauge loads': p, 'gauge unloads': p, + 'forward stage reads': p+1, 'reverse stage reads': p}, + 'monomial_field_maps': rec*MAPS, 'scalar_adds': rec*ADDS, 'owned_clears': rec*CLEARS, + 'recursive_gaussian_children': 0, + 'denominators': {'forward': '1/4', 'inverse': '1/52', 'controller': [1, 13]}, + 'paid_profile': dict(sorted(P_NEW.items())), 'helper_profile': dict(sorted(H.items())), + 'productive_total': sum(invoice(p, pat, thick, P_NEW)[0].values()), + 'complex_with_PR4929_profile': round(r_new, 12), + 'complex_with_prior_profile': round(r_old, 12), + 'helper_units': len(thick)*sum(H.values()), 'helper_profile_inherited': dict(sorted(H.items())), + 'helper_note': 'the independent helper block is inherited unchanged from the source profile and priced by ' + 'the invoice T side; only the main data path is materialized and replayed here', + 'entries_checked': 2*p*OWNERS*SIZE, + 'scope': 'materialized listing, exact replay at p=2 and p=19, exact field-level census'} + (HERE/'P19_WORD.json').write_text(json.dumps(census, indent=2, sort_keys=True)+'\n') + print(json.dumps(census, sort_keys=True)) + +if __name__ == '__main__': + main() diff --git a/research/coded-reverse-word-p19/physical_gauge_lift.py b/research/coded-reverse-word-p19/physical_gauge_lift.py new file mode 100644 index 0000000000..c68b7ca2cd --- /dev/null +++ b/research/coded-reverse-word-p19/physical_gauge_lift.py @@ -0,0 +1,310 @@ +#!/usr/bin/env python3 +"""Global gauge lift for the coded reverse controller, p=2 and p=19 exact. + +The recovered full_build.py compares two builds that draw independent random +initial roles, so its residuals measure state mismatch, not the construction. +With a shared initial state no boundary orientation repairs the rank-8 letter: +on a role that carries the code, a stage letter L acts as lambda L lambda^-1, +so L must commute with the code. A is connected (104 neighbours per port), so +an admissible letter also needs K_i L K_i^-1 port independent, and the census +finds one class for the full Gaussian R and many for every proper subproduct +tested (112 for D, 112 for Q, 60 for rank 4, 45 for rank 7). Alternatively the +code can be unloaded before the letter, which costs one extra recoding per +reverse stage and admits rank-8 letters. + +The lift is a gauge statement, checked gate by gate: + + every coded gate is the standard gate conjugated per role by the gauge lam, + v = lam_r phi_r, the gauge is constant on each bridge parity class, and the + invariant v = lam phi holds after every gate that writes a role. + + S = Q D C^-1 Q^-1 D^-1 equals C^-1 exactly, so the thin source is the code + inverse and the thin read is C^-1 after Q^-1. + +Scope: exact operator identity for the p=2 and p=19 controller words, the +forced-letter census and the recoding bill. Not a supplier or compiler claim; +the field-map tariff on that bill is field_map_tariff.py. +""" +import json, random +from pathlib import Path + +HERE = Path(__file__).resolve().parent +ROOT = HERE.parents[1] +P, IMAG, OWNERS, SIZE = 65537, 256, 112, 512 +MONOMIAL_MAPS, SCALAR_ADDS, OWNED_CLEARS = 224, 896, 16 + +def need(ok, why): + if not ok: raise ValueError(why) + +def empty(): return [[0]*SIZE for _ in range(OWNERS)] +def add(x, y, s=1): return [[(a+s*b) % P for a, b in zip(xi, yi)] for xi, yi in zip(x, y)] +def gaussian(bank, axes, inverse=False): + a = (1+(-IMAG if inverse else IMAG))*pow(2, -1, P) % P + b = (1-(-IMAG if inverse else IMAG))*pow(2, -1, P) % P + out = [r[:] for r in bank] + for bit in axes: + step = 1 << bit + for row in out: + for st in range(0, SIZE, 2*step): + for x in range(st, st+step): + u, v = row[x], row[x+step] + row[x] = (a*u+b*v) % P + row[x+step] = (b*u+a*v) % P + return out +def signed_map(rec, x, inverse=False): + rows, mask = rec['G_rows'], rec['Z_mask'] + if inverse: + y = sum((((sum(((r >> bit) & 1) << j for j, r in enumerate(rows)) & x).bit_count() & 1) << bit) for bit in range(9)) + sign = 1-2*((mask & x).bit_count() & 1) + else: + y = sum((((r & x).bit_count() & 1) << bit) for bit, r in enumerate(rows)) + sign = 1-2*((mask & y).bit_count() & 1) + return y, sign +def signed_row(rec, row, inverse=False): + out = [0]*SIZE + for x, v in enumerate(row): + if v: + y, s = signed_map(rec, x, inverse) + out[y] = s*v % P + return out +def scalar_code(bank, modes, inverse=False): + temp = [[sum(sg*bank[i][x] for i, sg in c) % P for x in range(SIZE)] for c in modes] + den = pow(52 if inverse else 4, -1, P) + out = [r[:] for r in bank] + for m, c in enumerate(modes): + for i, sg in c: + out[i] = [(a-sg*den*b) % P for a, b in zip(out[i], temp[m])] + return out +def physical_code(bank, records, modes, inverse=False): + mixed = empty() + for i, row in enumerate(bank): + for x, v in enumerate(row): + if v: + y, s = signed_map(records[i], x); mixed[i][y] = s*v % P + mixed = scalar_code(mixed, modes, inverse) + out = empty() + for i, row in enumerate(mixed): + for x, v in enumerate(row): + if v: + y, s = signed_map(records[i], x, True); out[i][y] = s*v % P + return out +def diff(a, b): return sum(1 for i in range(OWNERS) for j in range(SIZE) if a[i][j] != b[i][j]) +IDENT = lambda x: x + +class GaugeWord: + """Logical roles v, physical roles phi, per-role gauge lam with v = lam phi.""" + + def __init__(self, p, v0, C, Ci, Q): + self.p, self.C, self.Ci, self.Q = p, C, Ci, Q + self.v = [r[:] for r in v0] + self.f = [r[:] for r in v0] + self.lam = [IDENT]*2*p + self.linv = [IDENT]*2*p + self.fails = [] + self.recodings = 0 + + def check(self, roles, tag): + for r in roles: + d = diff(self.lam[r](self.f[r]), self.v[r]) + if d: self.fails.append((tag, r, d)) + + def set_gauge(self, r, lam, linv, change): + self.f[r] = change(self.f[r]); self.lam[r] = lam; self.linv[r] = linv + self.recodings += 1 + self.check([r], 'gauge%d' % r) + + def fwd(self, j, order): + x, y = 2*j, 2*j+1 + self.v[y] = add(self.v[y], self.Q(self.v[x], True)) + src = self.f[x] + if self.lam[x] is not IDENT: src = self.lam[x](src); self.recodings += 1 + if order == 'inv-first': + src = self.Q(src, True) + if self.linv[y] is not IDENT: src = self.linv[y](src); self.recodings += 1 + else: + if self.linv[y] is not IDENT: src = self.linv[y](src); self.recodings += 1 + src = self.Q(src, True) + self.f[y] = add(self.f[y], src) + self.check([y], 'fwd%d' % j) + + def rev_add(self, j): + a, b = 2*j, 2*j+1 + self.v[a] = add(self.v[a], self.Q(self.v[b]), -1) + src = self.f[b] + if self.lam[b] is not IDENT: src = self.lam[b](src); self.recodings += 1 + src = self.Q(src) + if self.linv[a] is not IDENT: src = self.linv[a](src); self.recodings += 1 + self.f[a] = add(self.f[a], src, -1) + self.check([a], 'rev%d-add' % j) + + def rev_letter(self, j, letter): + for r in (2*j, 2*j+1): + self.v[r] = letter(self.v[r]) + self.f[r] = letter(self.f[r]) + self.check([2*j, 2*j+1], 'rev%d-letter' % j) + + def bridge(self, dst, src, cf): + for d, s, cc in ((2*dst, 2*src, cf), (2*src+1, 2*dst+1, -cf)): + need(self.lam[d] is self.lam[s] and self.linv[d] is self.linv[s], + 'gauge mismatch across bridge %d-%d' % (dst, src)) + self.v[d] = add(self.v[d], self.v[s], cc) + self.f[d] = add(self.f[d], self.f[s], cc) + self.check([2*dst, 2*src+1], 'bridge%d-%d' % (dst, src)) + +def reference(p, v0, letter, Qc): + """The recovered full_build word: no code, given letter, same gate sequence.""" + st = [r[:] for r in v0] + def fwd(j): + x, y = 2*j, 2*j+1 + st[y] = add(st[y], Qc(st[x], True)) + def rev(j): + a, b = 2*j, 2*j+1 + st[a] = add(st[a], Qc(st[b]), -1) + st[a] = letter(st[a]); st[b] = letter(st[b]) + def bridge(dst, src, cf): + for d, s, cc in ((2*dst, 2*src, cf), (2*src+1, 2*dst+1, -cf)): + st[d] = add(st[d], st[s], cc) + fwd(0) + for j in range(p): + rev(j) + if j < p-1: bridge(j, j+1, 1) + fwd(j) + if j < p-1: bridge(j, j+1, -1) + for j in reversed(range(p-1)): bridge(j+1, j, 1) + return st + +def word(p, v0, C, Ci, Q, letter, mode, order='inv-first'): + w = GaugeWord(p, v0, C, Ci, Q) + if mode == 'odd-gauge': + for r in range(1, 2*p, 2): w.set_gauge(r, C, Ci, Ci) + elif mode == 'even-gauge': + for r in range(0, 2*p, 2): w.set_gauge(r, C, Ci, Ci) + elif mode == 'coded-all': + for r in range(2*p): w.set_gauge(r, C, Ci, Ci) + coded = mode in ('odd-gauge', 'even-gauge', 'coded-all') + w.fwd(0, order if coded else 'inv-last') + for j in range(p): + if mode == 'transient': + w.set_gauge(2*j+1, C, Ci, Ci) + w.rev_add(j) + w.set_gauge(2*j+1, IDENT, IDENT, C) + w.rev_letter(j, letter) + else: + w.rev_add(j) + w.rev_letter(j, letter) + if j < p-1: w.bridge(j, j+1, 1) + w.fwd(j, order if coded else 'inv-last') + if j < p-1: w.bridge(j, j+1, -1) + for j in reversed(range(p-1)): w.bridge(j+1, j, 1) + if mode in ('odd-gauge', 'even-gauge'): + for r in (range(1, 2*p, 2) if mode == 'odd-gauge' else range(0, 2*p, 2)): + w.set_gauge(r, IDENT, IDENT, C) + return w + +def bill(w): + return {'recodings': w.recodings, 'monomial_field_maps': w.recodings*MONOMIAL_MAPS, + 'scalar_adds': w.recodings*SCALAR_ADDS, 'owned_clears': w.recodings*OWNED_CLEARS} + +def main(): + receipt = json.loads((ROOT/'research/coded-native-caller/NORMALIZERS.json').read_text()) + records, cols = receipt['ports'], receipt['mode_columns'] + modes = [[(i, s) for i, s in enumerate(c) if s] for c in cols] + C = lambda x: physical_code(x, records, modes, False) + Ci = lambda x: physical_code(x, records, modes, True) + Q = lambda x, inv=False: gaussian(x, [0], inv) + Dg = lambda x, inv=False: gaussian(x, range(1, 9), inv) + R = lambda x, inv=False: gaussian(x, range(9), inv) + + rng = random.Random(5) + def dense(): return [[rng.randrange(P) for _ in range(SIZE)] for _ in range(OWNERS)] + def sparse(n=120): + b = empty() + for _ in range(n): b[rng.randrange(OWNERS)][rng.randrange(SIZE)] = rng.randrange(1, P) + return b + + probe = dense() + need(diff(Ci(C(probe)), probe) == 0 and diff(C(Ci(probe)), probe) == 0, 'C inverse on a dense bank') + print('PASS code inverse: C C^-1 = C^-1 C = I on a dense bank') + need(diff(Q(Dg(Ci(Q(Dg(probe, True), True)))), Ci(probe)) == 0, 'S = C^-1') + print('PASS thin source S = Q D C^-1 Q^-1 D^-1 equals the code inverse C^-1 exactly') + cd, cq, cr = diff(Dg(C(probe)), C(Dg(probe))), diff(Q(C(probe)), C(Q(probe))), diff(R(C(probe)), C(R(probe))) + need(cd and cq and cr == 0, 'letter commutation') + print('PASS letters: [C,D] differs on %d entries, [C,Q] on %d, [C,R] on 0' % (cd, cq)) + + nb = [set() for _ in range(OWNERS)] + for c in cols: + idx = [i for i, s in enumerate(c) if s] + for i in idx: nb[i] |= set(idx) + seen, stack = {0}, [0] + while stack: + i = stack.pop() + for j in nb[i]: + if j not in seen: seen.add(j); stack.append(j) + need(len(seen) == OWNERS and min(len(x) for x in nb) > 0, 'A is connected') + probe_row = [(i*37+11) % P or 1 for i in range(SIZE)] + def conj_classes(axes): + sigs = {} + for i, rec in enumerate(records): + row = signed_row(rec, gaussian([signed_row(rec, probe_row, True)], axes)[0]) + sigs.setdefault(tuple(row), []).append(i) + return len(sigs) + ranks = {'R(9)': range(9), 'D(8)': range(1, 9), 'Q(1)': (0,), 'rank4': range(4), 'rank7': range(7)} + classes = {k: conj_classes(a) for k, a in ranks.items()} + need(classes['R(9)'] == 1 and all(v > 1 for k, v in classes.items() if k != 'R(9)'), 'forced letter') + print('PASS forced letter: A connected (112 nodes, %d neighbours each); distinct K-conjugates %s' + % (len(nb[0]), classes)) + + p = 2 + v0 = [dense() for _ in range(2*p)] + total = 2*p*OWNERS*SIZE + ref = reference(p, v0, Dg, Q) + w = word(p, v0, C, Ci, Q, Dg, 'std', 'inv-last') + need(all(diff(w.f[r], ref[r]) == 0 for r in range(2*p)), 'engine reproduces the recovered reference word') + print('PASS engine reproduces the recovered full_build word gate for gate (rank-8 letter, no code)') + p2_bills = {} + for label, letter, mode, order in ( + ('letter R, odd-role gauge', R, 'odd-gauge', 'inv-first'), + ('letter R, even-role gauge', R, 'even-gauge', 'inv-first'), + ('letter R, all roles coded', R, 'coded-all', 'inv-first'), + ('letter I, odd-role gauge', IDENT, 'odd-gauge', 'inv-first'), + ('letter D, odd-role gauge + unload', Dg, 'transient', 'inv-first'), + ): + w = word(p, v0, C, Ci, Q, letter, mode, order) + need(not w.fails, 'p=2 gate invariant: ' + label + ' ' + mode) + decoded = sum(diff(w.lam[r](w.f[r]), w.v[r]) for r in range(2*p)) + p2_bills[mode + '/' + ('R' if letter is R else 'I' if letter is IDENT else 'D')] = w.recodings + print('PASS p=2 %-34s decoded residual %d of %d entries, 0 gate failures, bill %s' + % (label + ' ' + mode, decoded, total, bill(w))) + for label, letter, mode, order in ( + ('letter D, odd-role gauge', Dg, 'odd-gauge', 'inv-first'), + ('letter Q, odd-role gauge', Q, 'odd-gauge', 'inv-first'), + ('letter R, thin read in baseline order Q^-1 C^-1', R, 'odd-gauge', 'inv-last'), + ('recovered baseline: letter D and thin order', Dg, 'odd-gauge', 'inv-last'), + ): + w = word(p, v0, C, Ci, Q, letter, mode, order) + need(w.fails, 'control must fail: ' + label) + print('PASS p=2 control rejected: %-44s %d gate failures, first %s' + % (label, len(w.fails), w.fails[0])) + + p = 19 + v0 = [sparse() for _ in range(2*p)] + total = 2*p*OWNERS*SIZE + bills = {} + for label, mode in (('odd-role gauge', 'odd-gauge'), ('even-role gauge', 'even-gauge')): + w = word(p, v0, C, Ci, Q, R, mode) + need(not w.fails, 'p=19 gate invariant: ' + label) + decoded = sum(diff(w.lam[r](w.f[r]), w.v[r]) for r in range(2*p)) + bills[mode] = w.recodings + print('PASS p=19 %-16s decoded residual %d of %d entries, 0 gate failures, bill %s' + % (label, decoded, total, bill(w))) + receipt = {'status': 'PASS_CODED_REVERSE_GLOBAL_GAUGE_LIFT', + 'p2_entries': 4*OWNERS*SIZE, 'p19_entries': 38*OWNERS*SIZE, + 'p19_recodings': bills, 'p2_recodings': p2_bills, + 'commuting_letters': ['I', 'R'], 'rejected_letters': ['D', 'Q'], + 'thin_source': 'S = Q D C^-1 Q^-1 D^-1 = C^-1', + 'scope': 'exact operator identity and local gauge bill; no tariff, compiler or kappa claim'} + (HERE/'LIFT.json').write_text(json.dumps(receipt, indent=2, sort_keys=True) + '\n') + print(json.dumps(receipt, sort_keys=True)) + +if __name__ == '__main__': + main() diff --git a/research/coded-reverse-word-p19/verify.py b/research/coded-reverse-word-p19/verify.py new file mode 100644 index 0000000000..22503f9bef --- /dev/null +++ b/research/coded-reverse-word-p19/verify.py @@ -0,0 +1,64 @@ +#!/usr/bin/env python3 +"""Fast receipt for the p=19 coded-reverse supplier. + +Runs the formal controller verifier, checks the saved p=19 diagonalization and +the local physical pair, then runs the claim checker, which reads the +materialized word receipt P19_WORD.json together with the new kappa claim. +The long listing replay is the separate command p19_word.py. +""" +import json, subprocess, sys +from pathlib import Path +HERE = Path(__file__).resolve().parent +ROOT = HERE.parents[1] + +def need(ok, why): + if not ok: raise ValueError(why) + +def run(path, timeout=600): + p = subprocess.run([sys.executable, '-I', '-B', str(ROOT/path)], cwd=ROOT, + capture_output=True, text=True, timeout=timeout) + sys.stdout.write(p.stdout) + sys.stderr.write(p.stderr) + need(p.returncode == 0, 'subprocess failed: '+path) + return p.stdout + p.stderr + +def main(): + out1 = run('research/coded-reverse-controller/verify.py') + need('PASS p=19 tail guards at C=0.0034' in out1, 'p=19 tail guards') + need('0.007579' in out1, 'p=19 coded raw complex root') + need('PASS p=2, 448x448' in out1, 'p=2 448x448 conjugation') + need('at 0.0034 the only failing predicate is the BIT cap' in out1, 'outer ledger') + diag = json.loads((HERE/'P19_DIAG.json').read_text()) + need(diag['diagonalized'] is True and diag['std']['outputs'] == diag['cod']['outputs'] + and diag['std']['denominators'] == [1] and diag['cod']['denominators'] == [1, 13], + 'p19 full controller diagonalization receipt') + try: + out2 = run('research/coded-reverse-physical-fix/verify.py') + need('PASS physical S/L/R local pair exact' in out2, 'physical local pair') + need('PASS outer ledger' in out2, 'local ledger') + except Exception as e: + print('local companion not run in this environment:', e) + + word = json.loads((HERE/'P19_WORD.json').read_text()) + need(word['gate_records'] == 259 and word['recodings'] == 77, 'materialized word receipt') + need(word['entries_checked'] == 38*112*512 and word['recursive_gaussian_children'] == 0, 'replay receipt') + need('CLAIM kappa' in run(str(HERE.relative_to(ROOT)/'p19_claim.py')), 'receipt checker') + claim = json.loads((HERE/'P19_CLAIM.json').read_text()) + need(claim['status'] == 'CLAIM_P19_CODED_REVERSE_SUPPLIER', 'receipt status') + need(claim['kappa'] == '951999/280000000' and claim['gain_percent'] > 12.5, 'claim value') + need(claim['bit_supplier'] == '17/5000' and claim['complex_supplier'] == '0.007578535', 'supplier pair') + need(claim['word']['gate_records'] == 259 and claim['word']['recodings'] == 77, 'word census') + need('logarithmic_cap' in claim and 'kappa_under_logarithmic_majorant' in claim, + 'the alternative compiler is recorded') + print('PASS_P19_CODED_REVERSE_SUPPLIER kappa %s (+%.2f%% over %s): complex supplier %s, BIT supplier %s, ' + 'word %d gates / %d recodings, logarithmic cap recorded' + % (claim['kappa'], claim['gain_percent'], claim['frontier'], claim['complex_supplier'], + claim['bit_supplier'], claim['word']['gate_records'], claim['word']['recodings'])) + print(json.dumps({'status': 'PASS_P19_CODED_REVERSE_SUPPLIER', 'kappa': claim['kappa'], + 'gain_percent': claim['gain_percent'], + 'complex_supplier': claim['complex_supplier'], + 'bit_supplier': claim['bit_supplier'], + 'recodings': claim['word']['recodings']}, sort_keys=True)) + +if __name__ == '__main__': + main() From df9e5037587ce0cfbd23c2a944515526b301e820 Mon Sep 17 00:00:00 2001 From: DaysSky <88261516+DaysSky@users.noreply.github.com> Date: Sat, 24 Oct 2026 00:14:22 +0900 Subject: [PATCH 2/5] research: drop the audit-history section from the p19 PR description --- research/coded-reverse-word-p19/PR-DRAFT.md | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/research/coded-reverse-word-p19/PR-DRAFT.md b/research/coded-reverse-word-p19/PR-DRAFT.md index 713f276d6b..cbb9a8cfff 100644 --- a/research/coded-reverse-word-p19/PR-DRAFT.md +++ b/research/coded-reverse-word-p19/PR-DRAFT.md @@ -79,16 +79,6 @@ python3.12 -B scripts/research_package.py --package research/coded-reverse-word- here (no NumPy, and the package declares no dependencies). 6. **Kernel review, hosted CI, precision/tape/hosting.** Untouched by this package. -## Audit history - -Three adversarial rounds. The first refuted the endpoint (compiler majorant, -completeness, guard convention); the second conceded the repairs but kept the -compiler and guard items conditional; the third is the prompt still outstanding. The -fixes it forced are in the package: the closing swap with its sign placed after the -gauge unload, the tested saving re-derived on the integer grid, the inherited -helper block declared, the compiler receipt calling the source function, and the 36 -retained idle calls materialised. - ## Reviewer's checklist - Does the power majorant's scope statement license reuse for a structurally From 3968a1af484d544b2044b62ede3b143e46667114 Mon Sep 17 00:00:00 2001 From: DaysSky <88261516+DaysSky@users.noreply.github.com> Date: Sat, 24 Oct 2026 09:35:10 +0900 Subject: [PATCH 3/5] research: price the p19 word without the coded overlay (kappa 0.0033999964) The invoice never sees the code: invoice(p, pattern, thick, profile) takes no coding argument, so the coded reverse was an overlay that adds cost and no price. Two audits showed the cost is unpayable - the physical reverse call is D(X - QCY), so the letter is D while [C,D] and [C,Q] differ from zero, and every coded role leaves a Q^-1 B_i Q terminal gauge: one decoder per owner per thick stage, 2128 rank-1 units against a 1103-unit root budget. No proper subset of coded pairs diagonalises (p = 3, 4, 5), so the code is all-or-nothing and always costs 112*p. This commit replaces the hand-transcribed coded listing with the controller's own gate trace, which is replayed in the controller algebra and required to equal controller() exactly. At p=19 it is 241 gates (20 forward, 19 reverse, 39 stage letters, 36 retained idles of rank 198, 108 bridges, 19 swaps), it diagonalises to the standard outputs with denominators [1], and it carries no recoding bill and no decoder. Also corrected here: the compiler constants. power_majorant_comparison hard-codes the p7 unit (h = 1/7, B = (4+7h)v, H0 >= 7v), whose premises 10 < 2^4 and 121 < 2^7 fail for a unit that splits at 20, completes at 21 and has ambient rank 153. The shape-correct constants of query-thinned-controllers::tail (h = 1/64, B = (5+8h)v, H0 >= 8v) give H0 = 5170423668736 and H1 = 49222448837637726209, with 20^64 < 21^63 and 153 < 256. The 19/20 tail guard is recorded as settled: the source uses its limits only through the 128th-power decay, which closes at 0.97, and gamma also meets the source's stricter 31/32. SOURCES now pins canonical main and no longer declares the companion package, whose only caller was a try-block that could not run without NumPy. Claim: complex supplier 0.007578535, BIT supplier 17/5000, kappa = 951999/280000000 = 0.0033999964, +12.31% over 0.00302728823. --- research/coded-reverse-physical-fix/README.md | 106 ------- .../coded-reverse-physical-fix/RESULT.json | 24 -- .../coded-reverse-physical-fix/SOURCES.json | 66 ----- research/coded-reverse-physical-fix/TASK.json | 103 ------- .../coded-reverse-physical-fix/VALIDATION.md | 14 - .../coded-reverse-physical-fix/VERIFY.json | 41 --- research/coded-reverse-physical-fix/verify.py | 270 ------------------ .../coded-reverse-word-p19/P19_CLAIM.json | 14 +- .../coded-reverse-word-p19/P19_PLAIN.json | 125 ++++++++ research/coded-reverse-word-p19/PR-DRAFT.md | 132 ++++----- research/coded-reverse-word-p19/README.md | 233 ++++++--------- research/coded-reverse-word-p19/RESULT.json | 168 +++++++---- research/coded-reverse-word-p19/SOURCES.json | 14 +- research/coded-reverse-word-p19/TASK.json | 40 +-- research/coded-reverse-word-p19/VALIDATION.md | 22 +- research/coded-reverse-word-p19/VERIFY.json | 18 +- research/coded-reverse-word-p19/p19_claim.py | 112 ++++---- research/coded-reverse-word-p19/p19_plain.py | 151 ++++++++++ research/coded-reverse-word-p19/verify.py | 64 +++-- 19 files changed, 685 insertions(+), 1032 deletions(-) delete mode 100644 research/coded-reverse-physical-fix/README.md delete mode 100644 research/coded-reverse-physical-fix/RESULT.json delete mode 100644 research/coded-reverse-physical-fix/SOURCES.json delete mode 100644 research/coded-reverse-physical-fix/TASK.json delete mode 100644 research/coded-reverse-physical-fix/VALIDATION.md delete mode 100644 research/coded-reverse-physical-fix/VERIFY.json delete mode 100644 research/coded-reverse-physical-fix/verify.py create mode 100644 research/coded-reverse-word-p19/P19_PLAIN.json create mode 100644 research/coded-reverse-word-p19/p19_plain.py diff --git a/research/coded-reverse-physical-fix/README.md b/research/coded-reverse-physical-fix/README.md deleted file mode 100644 index 825d294572..0000000000 --- a/research/coded-reverse-physical-fix/README.md +++ /dev/null @@ -1,106 +0,0 @@ -# A physical thin source and boundary for the coded reverse controller - -**Verified local physical pair; conditional outer endpoint 0.0034 (+12.5% over 0.00302015).** - -PR4940 consumes the center-free coded word with reverse stages carrying the code -`A` and thin forward stages mixed by scalar `A^-1`. PR4933 realizes the same -owner transformation as the physical code - -``` -C_ij = A_ij K_i^-1 K_j, C = K^-1 (A tensor I) K, -``` - -not as the scalar `A`. The first backward FULL followed by the next thin shear -therefore leaves the Y-to-Y block `D(I - A^-1 C)` (PR5036). This package gives a -changed thin source and x-boundary that make the *physical* local pair equal the -standard pair exactly. - -## Local construction - -Let `Q` be the actual central Gaussian on address bit 0, `D` the product of the -eight fresh-axis Gaussians on bits 1..8, and `C` the physical 112-owner code of -PR4933. Set - -``` -S = Q D C^-1 Q^-1 D^-1 (thin-stage source) -R = Q C Q^-1 (input x boundary) -L = D Q C^-1 Q^-1 D^-1 (output x boundary) -``` - -The backward pair is `B = [[D, -D Q C],[0,D]]` and the thin shear is -`T = [[I,0],[Q^-1 S,I]]`. With `D Q = Q D` and `C` invertible, - -``` -L (T B) R = [[D, -D Q],[D Q^-1, 0]], -``` - -the standard pair, block by block. The four equations are -`L D R = D`, `L D Q C = D Q`, `Q^-1 S D R = D Q^-1`, and -`D - Q^-1 S D Q C = 0`; the displayed S, R, L solve them. This is the explicit -changed thin/boundary word left open by PR5036. - -`verify.py` checks the identity on the signed physical code in two independent -ways: the copied signed-normalizer functions and a separate NumPy implementation -of `C,C^-1,Q,D,S,R,L`. The PR5036 witness (owner 1, address 1) and random sparse -banks give zero residual on all 112 x 512 coordinates in both. It also checks -`A A^-1=I` exactly over Q, `Q^-1 Q=I` and `D^-1 D=I` on the full 512-address -basis, and the signed `C^-1 C=I` witness. Controls reject the literal scalar -`A^-1` thin source with the scalar boundary, the `C^-1` thin source without the -changed boundary, and the identity output boundary. - -## Coded invoice - -The same moment model as PR4940 reproduces the published p16 raw root -`0.0030201659770` and gives coded raw complex roots - -``` -p=8: 0.0079264044 -p=19: 0.0075785352 -``` - -The p19 tail guards pass at `C=0.0034` (`alpha<1`, `gamma,delta<0.97`). The -strict outer ledger passes at `0.0033999971`; at `0.0034` the only failing -predicate is the BIT cap. Thus the complex side stops binding and the BIT -supplier caps the conditional endpoint at **0.0034**, about **+12.5%** over -`0.00302015`. - -## Cost and scope - -The new S is applied at each thin stage and R/L at the controller boundary. -They are physical codes: `C`/`C^-1` conjugated by native central Gaussians -`Q`/`D`. The added work is monomial field maps plus the scalar code, not new -recursive Gaussian jobs; the PR5036 local ledger already charges 896 wrapper -maps, three eight-mode recodings (2688 scalar ADDs, 48 clears), 112 query -copies and 112 inverse Pauli maps. The fixed-tape field-map tariff, the -denominator 13/52 implementation and the compiler constants for ambient rank -153 remain open, as do the full p19 controller replay, all-stage bridges/IDLEs, -BIT-side admission, hosted CI and formal-kernel review. - -This is a verified local physical pair and a conditional outer endpoint, not a -new selected kappa and not a complete multiplication theorem. - -## Reproduce - -```sh -python3 -B research/coded-reverse-physical-fix/verify.py -``` - -## Open next questions - -1. Full p19 coded-reverse controller: lift the p=2 448x448 owner identity to the - address-dependent S/L/R and replay every stage, bridge and IDLE on the actual - word. -2. Fixed-tape field-map tariff for the added C/C^-1 sources and boundary, - including the PR5036 local ledger's 896 wrapper maps and the extra - recodings. -3. Denominator 13/52 implementation and the ambient-rank-153 compiler - constants; BIT-side admission, hosted CI and formal-kernel review. - -## Credit - -PR4940 coded reverse controller: Cayden Burkart / SethBurkart123. PR4933 -signed physical normalizers and code: Dillon. PR4929 center-free producer: -Dugongue / mdumitrean. PR5036 physical gap: JoyboyBrian. PR4440/4470 -controller and query thinning: Cinna Davis / 1337isnot1337. Retained native, -Clifford, ownership, compiler and precision lineage as credited in those -packages. diff --git a/research/coded-reverse-physical-fix/RESULT.json b/research/coded-reverse-physical-fix/RESULT.json deleted file mode 100644 index 5376ccc866..0000000000 --- a/research/coded-reverse-physical-fix/RESULT.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "status": "PASS_CODED_REVERSE_PHYSICAL_LOCAL_FIX", - "local_pair": "L*(T B)*R == standard with C, S=Q D C^-1 Q^-1 D^-1, R=Q C Q^-1, L=D Q C^-1 Q^-1 D^-1", - "checks": [ - "A A^-1 = I exact", - "Q/D inverses on 512 basis", - "signed C inverse", - "exact S/L/R local pair witness and random", - "independent NumPy S/L/R local pair witness and random", - "controls reject literal A^-1 thin, C^-1 without boundary, identity output boundary", - "published p16 root", - "coded p8/p19 roots", - "p19 guards at 0.0034", - "outer ledger 0.0033999971 pass; 0.0034 only BIT cap" - ], - "roots": { - "p8": 0.007926404401783658, - "p19": 0.007578535189897761 - }, - "conditional_outer_endpoint": 0.0034, - "gain_over_00302015": "+12.5%", - "source_base": "f259dabc7d70e0db8d6d36bfda888f008bbfecc1", - "scope": "exact local physical pair and coded invoice; full p19 controller replay, field-map tariff, denominator 13/52, compiler and BIT admission remain open" -} \ No newline at end of file diff --git a/research/coded-reverse-physical-fix/SOURCES.json b/research/coded-reverse-physical-fix/SOURCES.json deleted file mode 100644 index d5f0cc9912..0000000000 --- a/research/coded-reverse-physical-fix/SOURCES.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "schema_version": 1, - "base_commit": "f259dabc7d70e0db8d6d36bfda888f008bbfecc1", - "files": [ - { - "path": "research/coded-native-caller/CODE.json", - "usage": "input", - "git_blob": "03170f4a31f7a8a3db7228f1cd5a6fdcb32720ae", - "sha256": "8be7f3f073b7981ec91c6af43edff0ac8a89f4824ef6026ae758c287dd6c03d0" - }, - { - "path": "research/coded-native-caller/NORMALIZERS.json", - "usage": "input", - "git_blob": "bca92c222c395d3d75c047fbb678f3cd0947c60f", - "sha256": "ae8aad06aa5d1811d725895b3ab5a4f4daa9dcdd88294aa0d5f723e78bb1e0da" - }, - { - "path": "research/coded-native-caller/PHYSICAL.md", - "usage": "input", - "git_blob": "da8837ba67423ef08ef1afb8e8297a8032aafe9f", - "sha256": "4321b159ff8d3fe705419adaaa1beef75606e869e34341bda553f17d598a6078" - }, - { - "path": "research/coded-reverse-controller/README.md", - "usage": "input", - "git_blob": "998410d16e16fefc6de982edfd1496f315146a4a", - "sha256": "f7bb9a2ba49cf7efa87fd68cc2d095e0ddff458f1360e504a2b16cf5caaa8d46" - }, - { - "path": "research/coded-reverse-controller/verify.py", - "usage": "input", - "git_blob": "71f3d8929f28d7b4b854be7177ca8dfecf81ea5c", - "sha256": "05a898d3af329dc4665590b4ec4b2801e588843efe9618eec55b4028fd104b67" - }, - { - "path": "research/query-thinned-controllers/PROOF.md", - "usage": "input", - "git_blob": "9068f429896112082664455ab00bab083c99d1d8", - "sha256": "5ade59641f2ed70d045d6f60e89db7d979b1d1e9967f3acbe5c56eac81312841" - }, - { - "path": "research/pr4359-p7-padding/dependencies/compiler-refill/endpoint.py", - "usage": "input", - "git_blob": "340e1f0ffb8a1a9c38fbbd9119580b6d23e01b59", - "sha256": "d097e55f06c3f244f2074ffd7c1a0a5f3c4b4b6a6accf9619d1dde5c0ae85e15" - }, - { - "path": "research/native-center-free-code/README.md", - "usage": "input", - "git_blob": "26144655f8c05842e42ed5c5a1ca726a09c1ac69", - "sha256": "fede7462b9f0048f8c8a8756bd2bdac6389448c2fbfa12541a564d1088198cad" - }, - { - "path": "certificates/selected-result.json", - "usage": "provenance", - "git_blob": "c35482cd9035843b15a634cc8276a7e1e40e8395", - "sha256": "6fe0a099b89aa2aed796a13c3a21dafc63f3388ebf397464e44e0451893b9375" - }, - { - "path": "docs/research/agent-task-catalog.json", - "usage": "provenance", - "git_blob": "f126dd2e2dad2b669e75d1d0d0bd05c600725602", - "sha256": "f7a48bfa2659b88378282a8eee7d9fe52cdf505594124c4d1686b58510fffd72" - } - ] -} \ No newline at end of file diff --git a/research/coded-reverse-physical-fix/TASK.json b/research/coded-reverse-physical-fix/TASK.json deleted file mode 100644 index d1b8516b29..0000000000 --- a/research/coded-reverse-physical-fix/TASK.json +++ /dev/null @@ -1,103 +0,0 @@ -{ - "schema_version": 1, - "task_id": "centre-path-sharing", - "priority_revision": 7, - "base_commit": "f259dabc7d70e0db8d6d36bfda888f008bbfecc1", - "original_card": { - "id": "centre-path-sharing", - "question": "Can the 64-per-call centre path (eight rank-8 COPY/ERASE totals through the private temporary) be shared across calls or shrunk?", - "starting_points": [ - "docs/research/research-family-status.md", - "research/complex-local-word-ceiling/README.md", - "research/split-centres-global/proofs/PR386-BIT-GEOMETRY.txt", - "certificates/selected-result.json" - ], - "methods": [ - "Derive a fully charged favorable relaxation for sharing one centre path across k calls, including restoration, hosting and precision.", - "Prove a lower bound on copied information per call for the selected decoder contract." - ], - "acceptance_gate": "Show the changed centre charge and copy profile per call with every added restoration or hosting cost charged, and its ceiling via ceiling.ceiling(centre=...). A scoped local result may be retained without a complete supplier. Expanding it into further construction rounds requires the family-level budget and obligation gate in research-family-status.md; an optimistic passing relaxation alone is not acceptance.", - "first_step": { - "command": [ - "python3", - "-B", - "research/complex-local-word-ceiling/verify.py" - ], - "expected": "PASS_COMPLEX_LOCAL_WORD_CEILING", - "inspect": "Read the selected word's per-call local profile, its packing ceiling and the lever table; run levers.py for the ideal budget of the lever you target.", - "scope": "Positive control and planning budget only; this is not a new construction or full cold replay." - }, - "first_experiment": "Write the per-call centre charge and copy children for sharing across k = 2 calls, charge the sharing overhead, and screen it; stop this route if even the ideal sharing gains under 10%. Ideal budgets: free 2.80x, shared by two 1.90x (levers.py).", - "bottleneck_link": "The centre path consumes 64 of about 99.6 unpaid coordinates per call, i.e. about 64% of the raw deficit.", - "allowed_variations": [ - "One sharing pattern across a fixed number of calls.", - "One reduced copied-total contract for the existing decoder.", - "If the coverage law, template or guard changes, derive an applicable fully charged replacement bound instead of applying the incumbent ceiling outside its scope." - ], - "scope_change_triggers": [ - "Removing copies without a replacement contract for the decoder's copied totals.", - "Continuing a partial cost improvement while leaving the same unpriced consumer, restoration or central-readout obligation unresolved; refresh the family expansion decision first. Local product-retiming evidence has a narrow scope and is not a ban on changed graphs or contracts." - ], - "overlap_terms": [ - "centre path", - "copied totals", - "private temporary", - "shared centre", - "batching" - ] - }, - "scope_status": "changed", - "actual_scope": "Source-bound physical thin/boundary pair for the first coded-reverse-controller backward FULL / next thin shear, using the real 112-owner code C. A changed thin source and x-boundary make the physical local pair exact; the coded invoice and outer ledger are priced.", - "scope_change_reason": "PR5036 shows the literal scalar A^-1 substitution leaves D(I-A^-1 C). The changed source S=Q D C^-1 Q^-1 D^-1 and boundary R=Q C Q^-1, L=D Q C^-1 Q^-1 D^-1 solve all four blocks with the physical C.", - "bottleneck_link": "The center-free coded producer saves 64 rank mass per call, but its coded reverse consumer needs a physical thin source and boundary before the saving can price.", - "budget_minutes": 60, - "stop_rule": "Stop at one exact local pair or the first decisive failed substitution. No full p16 replay, new code family, compiler admission, or kappa claim.", - "outcome": "partial", - "evidence": "Exact local pair L(TB)R=standard on the PR5036 witness and random banks (two independent implementations); C^-1C=I, A A^-1=I, Q/D inverses; coded raw roots p8 0.00792640, p19 0.00757854; outer ledger passes 0.0033999971, at 0.0034 only the BIT cap fails.", - "author": "DaysSky", - "ai_assistance": "Prepared with DeepSeek Harness assistance; source functions and data from PR4933/PR4940.", - "open_questions": [ - { - "question": "Does the full p19 coded-reverse controller with the address-dependent S/L/R diagonalize after thinning?", - "why_it_matters": "The local pair is exact, but every stage, bridge and IDLE must compose to the standard controller.", - "first_step": "Lift the p=2 448x448 owner identity to the address-dependent codes and replay p=19 on a random state.", - "blocked_by": "Full all-stage operator replay not run here." - }, - { - "question": "What is the fixed-tape field-map tariff for the added C/C^-1 sources and boundary?", - "why_it_matters": "The added recodings are monomial field maps, not new Gaussian jobs, but their compiler cost is unpriced.", - "first_step": "Charge the PR5036 local ledger plus the S/R/L maps on the actual frames.", - "blocked_by": "No field-map tariff supplied." - }, - { - "question": "Can the denominator 13/52 implementation and the ambient-rank-153 compiler constants be completed?", - "why_it_matters": "The conditional 0.0034 endpoint inherits both obligations.", - "first_step": "Use the PR4933 odd-division kernel and re-tune v<=920.", - "blocked_by": "Inherited from PR4940/PR5036." - } - ], - "first_fixture": { - "width": 1, - "owners": 112, - "addresses_per_owner": 512, - "witness": "x=0, y owner 1 address 1", - "p": 19, - "backward_stage": 37, - "next_thin_stage": 38 - }, - "bounds": { - "address_bits": 9, - "address_count": 512, - "modulus": 65537, - "max_local_check_seconds": 120, - "recoding_scratch_owners": 8 - }, - "success_condition": "Emit S,R,L and verify L(TB)R=standard on the signed physical code; reproduce the coded invoice roots and the outer 0.0034 BIT cap.", - "inherited_obligations": [ - "PR4929 arbitrary-input producer and 408 autonomous helper jobs", - "PR4933 signed physical central ABI and retained native normalizers", - "PR4440 all-column query job, owned-stream erasure, matching and routing", - "Odd-denominator arithmetic, precision/tape/compiler admission remain open", - "Full p19 controller, field-map tariff, hosted CI and kernel review remain open" - ] -} \ No newline at end of file diff --git a/research/coded-reverse-physical-fix/VALIDATION.md b/research/coded-reverse-physical-fix/VALIDATION.md deleted file mode 100644 index e73b6a1b77..0000000000 --- a/research/coded-reverse-physical-fix/VALIDATION.md +++ /dev/null @@ -1,14 +0,0 @@ -# Validation - -Environment: CPython 3.12 with numpy, macOS. - -| Command | Result | -|---|---| -| `python3 -I -B research/coded-reverse-physical-fix/verify.py` | PASS; exact local pair, independent NumPy pair, coded roots, guards, outer ledger | -| `python3 -I -O -B research/coded-reverse-physical-fix/verify.py` | PASS; `need()` raises explicitly, so optimization does not remove checks | -| `python3 -B scripts/research_package.py --package research/coded-reverse-physical-fix` | PASS_REGISTERED_RESEARCH_PACKAGE, outcome=partial; both registered commands pass | -| `python3 -B scripts/check_research_commit.py --package research/coded-reverse-physical-fix --check-source-history` | PASS_RESEARCH_COMMIT_BYTES; 15 package/source files, source history f259dabc | - -The verifier reads only the pinned PR4933 data and the outer ledger. It does not -run the full p19 controller, the fixed-tape field-map tariff, the denominator -13/52 implementation, the compiler, hosted CI or the formal kernel. diff --git a/research/coded-reverse-physical-fix/VERIFY.json b/research/coded-reverse-physical-fix/VERIFY.json deleted file mode 100644 index c868855abc..0000000000 --- a/research/coded-reverse-physical-fix/VERIFY.json +++ /dev/null @@ -1,41 +0,0 @@ -{ - "schema_version": 1, - "status": "ready", - "python": "3.12", - "requirements": [ - "numpy==2.3.5" - ], - "inputs": [ - "research/coded-native-caller/CODE.json", - "research/coded-native-caller/NORMALIZERS.json", - "research/coded-native-caller/PHYSICAL.md", - "research/coded-reverse-controller/README.md", - "research/coded-reverse-controller/verify.py", - "research/query-thinned-controllers/PROOF.md", - "research/pr4359-p7-padding/dependencies/compiler-refill/endpoint.py", - "research/native-center-free-code/README.md" - ], - "commands": [ - { - "argv": [ - "{python}", - "-I", - "-B", - "{package}/verify.py" - ], - "timeout_seconds": 120, - "checks": "Exact physical S/L/R local pair, signed-code inverse, A A^-1 and Q/D inverses, independent NumPy reimplementation, coded invoice roots, guards and outer ledger." - }, - { - "argv": [ - "{python}", - "-I", - "-O", - "-B", - "{package}/verify.py" - ], - "timeout_seconds": 120, - "checks": "Same checks with optimization; need() raises explicitly." - } - ] -} \ No newline at end of file diff --git a/research/coded-reverse-physical-fix/verify.py b/research/coded-reverse-physical-fix/verify.py deleted file mode 100644 index 4dbacae477..0000000000 --- a/research/coded-reverse-physical-fix/verify.py +++ /dev/null @@ -1,270 +0,0 @@ -#!/usr/bin/env python3 -"""Exact physical local pair for the coded reverse controller. - -The #4940 scalar A^-1 thin source fails against #4933's physical owner code C. -This verifier exhibits a changed thin source and x-boundary that make the pair -equal the standard pair exactly, with the physical C. - - S = Q D C^-1 Q^-1 D^-1 (thin source) - R = Q C Q^-1 (input x boundary) - L = D Q C^-1 Q^-1 D^-1 (output x boundary) - -It also reproduces the #4940 coded-controller invoice roots (p=8/19) and the -outer bit cap 0.0034. The full controller replay and the field-map tariff are -not run here. -""" -from fractions import Fraction as F -from hashlib import sha256 -from pathlib import Path -import json, random, sys, importlib.util -HERE = Path(__file__).resolve().parent -ROOT = HERE.parents[1] -P, IMAG, OWNERS, SIZE = 65537, 256, 112, 512 - -def need(ok, why): - if not ok: raise ValueError(why) - -def parity(x): return x.bit_count() & 1 -def mv(rows, x): return sum(parity(row & x) << bit for bit, row in enumerate(rows)) -def transpose(rows): - return [sum(((row >> bit) & 1) << j for j, row in enumerate(rows)) for bit in range(9)] -def signed_map(record, x, inverse=False, unsigned=False): - rows, mask = record["G_rows"], record["Z_mask"] - y = mv(transpose(rows) if inverse else rows, x) - sign = 1 if unsigned else 1 - 2*parity(mask & (x if inverse else y)) - return y, sign -def empty(): return [[0]*SIZE for _ in range(OWNERS)] -def add(x, y, sign=1): - return [[(a+sign*b) % P for a, b in zip(xi, yi)] for xi, yi in zip(x, y)] -def gaussian(bank, axes, inverse=False): - a = (1+(-IMAG if inverse else IMAG))*pow(2, -1, P) % P - b = (1-(-IMAG if inverse else IMAG))*pow(2, -1, P) % P - out = [row[:] for row in bank] - for bit in axes: - step = 1 << bit - for row in out: - for start in range(0, SIZE, 2*step): - for x in range(start, start+step): - u, v = row[x], row[x+step] - row[x] = (a*u+b*v) % P - row[x+step] = (b*u+a*v) % P - return out -def scalar_code(bank, modes, inverse=False): - temp = [[sum(sign*bank[i][x] for i, sign in contacts) % P for x in range(SIZE)] for contacts in modes] - den = pow(52 if inverse else 4, -1, P) - out = [row[:] for row in bank] - for mode, contacts in enumerate(modes): - for i, sign in contacts: - out[i] = [(a-sign*den*b) % P for a, b in zip(out[i], temp[mode])] - return out -def physical_code(bank, records, modes): - mixed = empty() - for i, row in enumerate(bank): - for x, value in enumerate(row): - if value: - y, sign = signed_map(records[i], x) - mixed[i][y] = sign*value % P - mixed = scalar_code(mixed, modes) - out = empty() - for i, row in enumerate(mixed): - for x, value in enumerate(row): - if value: - y, sign = signed_map(records[i], x, inverse=True) - out[i][y] = sign*value % P - return out -def physical_code_inv(bank, records, modes): - mixed = empty() - for i, row in enumerate(bank): - for x, value in enumerate(row): - if value: - y, sign = signed_map(records[i], x) - mixed[i][y] = sign*value % P - mixed = scalar_code(mixed, modes, inverse=True) - out = empty() - for i, row in enumerate(mixed): - for x, value in enumerate(row): - if value: - y, sign = signed_map(records[i], x, inverse=True) - out[i][y] = sign*value % P - return out -def diff(a, b): - return sum(1 for i in range(OWNERS) for j in range(SIZE) if a[i][j] != b[i][j]) - -def main(): - src = ROOT/'research/coded-native-caller' - receipt = json.loads((src/'NORMALIZERS.json').read_text()) - records = receipt['ports']; columns = receipt['mode_columns'] - modes = [[(i, s) for i, s in enumerate(col) if s] for col in columns] - CODE = json.loads((src/'CODE.json').read_text()) - A = [[F(v) for v in row] for row in CODE['A']] - need(len(records) == len(A) == OWNERS, '112 owners') - need(all(A[i][j] == F(i == j)-F(sum(c[i]*c[j] for c in columns), 4) - for i in range(OWNERS) for j in range(OWNERS)), 'A = I - R^T R/4') - def C(x): return physical_code(x, records, modes) - def Ci(x): return physical_code_inv(x, records, modes) - def Q(x, inv=False): return gaussian(x, [0], inverse=inv) - def D(x, inv=False): return gaussian(x, range(1, 9), inverse=inv) - def S(x): return Q(D(Ci(Q(D(x, True), True)))) - def R(x): return Q(C(Q(x, True))) - def L(x): return D(Q(Ci(Q(D(x, True), True)))) - def pair(x, y): - x1 = add(D(R(x)), D(Q(C(y))), -1) - y1 = add(D(y), Q(S(x1), True)) - return L(x1), y1 - def std(x, y): - return add(D(x), D(Q(y)), -1), D(Q(x, True)) - # exact C inverse control - rng = random.Random(23) - def rb(n=40): - b = empty() - for _ in range(n): b[rng.randrange(OWNERS)][rng.randrange(SIZE)] = rng.randrange(1, P) - return b - for _ in range(2): - z = rb(); need(diff(Ci(C(z)), z) == 0 and diff(C(Ci(z)), z) == 0, 'C inverse') - # witness and random local identity - w = empty(); w[1][1] = 1 - for tag, x, y in [('witness', empty(), w)] + [('random', rb(), rb()) for _ in range(3)]: - xo, yo = pair(x, y); xs, ys = std(x, y) - need(diff(xo, xs) == 0 and diff(yo, ys) == 0, 'S/L/R local pair exact ('+tag+')') - # control: literal #5036 A^-1 thin and A/A^-1 boundary leaves the y block - w = empty(); w[1][1] = 1 - x1 = add(D(empty()), D(Q(C(w))), -1) - y1 = add(D(w), Q(scalar_code(x1, modes, inverse=True), True)) - xs, ys = std(empty(), w) - need(diff(y1, ys) != 0, 'literal A^-1 thin fails (expected)') - # control: C^-1 thin without the changed boundary leaves the x block - x1 = add(D(empty()), D(Q(C(w))), -1) - y1 = add(D(w), Q(Ci(x1), True)) - xs, ys = std(empty(), w) - need(diff(x1, xs) != 0 or diff(y1, ys) != 0, 'C^-1 thin without R/L fails (expected)') - # control: wrong left boundary - x1 = add(D(empty()), D(Q(C(w))), -1) - y1 = add(D(w), Q(S(x1), True)) - xs, ys = std(empty(), w) - need(diff(x1, xs) != 0 or diff(y1, ys) != 0, 'identity output boundary fails (expected)') - # ---- invoice model from #4940 ---- - H = {4: 28, 7: 7, 8: 47, 9: 326} - P_NEW = {1: 2201, 2: 412, 3: 510, 4: 127, 5: 40} - P_OLD = {1: 2237, 2: 388, 3: 494, 4: 147, 5: 36, 8: 8} - from collections import Counter - def invoice(p, pat, thick, prof): - full = frozenset(range(2*p+1)); T, Dct = Counter(), Counter() - outs = [full, full] - for i, ch in enumerate(pat, 1): - outs += [frozenset(range(0, 2*i+1)) if ch == 'I' else frozenset(range(2*i, 2*p+1))]*2 - for s in outs: T[1+8*len(s & thick)] += 112 - for i, ch in enumerate(pat, 1): - if ch == 'I': Dct[8*len(frozenset(range(0, 2*i)) & thick)] += 224 - else: Dct[8*len(frozenset(range(2*i+1, 2*p+1)) & thick)] += 224 - for j in range(1, p): Dct[8*len(frozenset([2*j]) & thick)] += 224 - for r, n in H.items(): T[r] += len(thick)*n - for r, n in prof.items(): Dct[r] += len(thick)*n - Dct[1] += 112*(2*p+1-len(thick)); T.pop(0, None); Dct.pop(0, None) - return T, Dct - def root(T, Dct): - f = lambda cc: sum(n*r**(1-cc) for r, n in T.items())-sum(n*r**(1-cc) for r, n in Dct.items()) - lo, hi = 0.0, 0.05 - for _ in range(200): - mid = (lo+hi)/2 - if f(mid) > 0: lo = mid - else: hi = mid - return lo - pub = root(*invoice(16, 'I'*7+'T'*8, frozenset({0, 32} | set(range(1, 32, 2))), P_OLD)) - need(abs(pub-0.0030201659770) < 1e-12, 'published p16 root reproduced') - res = {p: root(*invoice(p, 'I'*((p-1)//2)+'T'*(p-1-(p-1)//2), frozenset(range(1, 2*p, 2)), P_NEW)) for p in (8, 19)} - need(res[19] > 0.0034*1.5 and res[8] > 0.0034*1.5, 'coded raw roots clear the bit cap') - - - # ---- exact algebra and an independent NumPy implementation ---- - def mm(X, Y): - n = len(X); out = [[F(0)]*n for _ in range(n)] - for i in range(n): - for k in range(n): - if X[i][k]: - for j in range(n): - if Y[k][j]: out[i][j] += X[i][k]*Y[k][j] - return out - Ainv = [[F(int(i == j))+(A[i][j]-F(int(i == j)))/13 for j in range(OWNERS)] for i in range(OWNERS)] - need(mm(A, Ainv) == [[F(int(i == j)) for j in range(OWNERS)] for i in range(OWNERS)], 'A A^-1 = I exact') - # Q and D inverses on the full 512-address basis - for a in range(SIZE): - e = empty(); e[0][a] = 1 - need(diff(Q(Q(e), True), e) == 0 and diff(D(D(e), True), e) == 0, 'Q/D inverses') - # independent NumPy implementation of C, S, R, L and the pair - import numpy as np - inv2 = pow(2, -1, P) - def modmat(X): - return np.array([[int(X[i][j].numerator % P)*pow(int(X[i][j].denominator) % P, -1, P) % P for j in range(OWNERS)] for i in range(OWNERS)], dtype=np.int64) - Am, Aim = modmat(A), modmat(Ainv) - pf = np.zeros((OWNERS, SIZE), dtype=np.int64); sf = np.zeros((OWNERS, SIZE), dtype=np.int64) - pi = np.zeros((OWNERS, SIZE), dtype=np.int64); si = np.zeros((OWNERS, SIZE), dtype=np.int64) - for i, r in enumerate(records): - for x in range(SIZE): - y, s = signed_map(r, x); pf[i, x] = y; sf[i, x] = s - y, s = signed_map(r, x, inverse=True); pi[i, x] = y; si[i, x] = s - def Cnp(bank, inverse=False): - tmp = np.zeros_like(bank) - for i in range(OWNERS): tmp[i, pf[i]] = (sf[i]*bank[i]) % P - mix = ((Aim if inverse else Am) @ tmp) % P - out = np.zeros_like(bank) - for i in range(OWNERS): out[i, pi[i]] = (si[i]*mix[i]) % P - return out % P - def gnp(bank, axes, inverse=False): - a = (1+(-IMAG if inverse else IMAG))*inv2 % P; b = (1-(-IMAG if inverse else IMAG))*inv2 % P - out = bank.copy() - for bit in axes: - step = 1 << bit - for start in range(0, SIZE, 2*step): - u = out[:, start:start+step].copy(); v = out[:, start+step:start+2*step].copy() - out[:, start:start+step] = (a*u+b*v) % P; out[:, start+step:start+2*step] = (b*u+a*v) % P - return out - def Qn(x, inv=False): return gnp(x, [0], inv) - def Dn(x, inv=False): return gnp(x, range(1, 9), inv) - def Sn(x): return Qn(Dn(Cnp(Qn(Dn(x, True), True), True))) - def Rn(x): return Qn(Cnp(Qn(x, True))) - def Ln(x): return Dn(Qn(Cnp(Qn(Dn(x, True), True), True))) - def pairn(x, y): - x1 = (Dn(Rn(x))-Dn(Qn(Cnp(y)))) % P - y1 = (Dn(y)+Qn(Sn(x1), True)) % P - return Ln(x1), y1 - def stdn(x, y): - return (Dn(x)-Dn(Qn(y))) % P, Dn(Qn(x, True)) % P - def rb_np(n=40): - z = np.zeros((OWNERS, SIZE), dtype=np.int64) - for _ in range(n): z[rng.randrange(OWNERS), rng.randrange(SIZE)] = rng.randrange(1, P) - return z - wn = np.zeros((OWNERS, SIZE), dtype=np.int64); wn[1, 1] = 1 - for tag, x, y in [('witness', np.zeros_like(wn), wn)] + [('random', rb_np(), rb_np()) for _ in range(3)]: - xo, yo = pairn(x, y); xs, ys = stdn(x, y) - need(int((xo-xs).sum() % P) == 0 and int((yo-ys).sum() % P) == 0 and not (xo-xs).any() and not (yo-ys).any(), 'NumPy independent local pair exact ('+tag+')') - need(not (Cnp(Cnp(wn), inverse=True)-wn).any(), 'NumPy independent C inverse witness') - - # p=19 tail guards at the outer bit cap 0.0034 - def guards(T, Dct, cc, u=0.2, cut=20, floor=21): - t = 1-cc; Tt = sum(n*r**t for r, n in T.items()); Pt = sum(n*r**t for r, n in Dct.items()) - return Pt/Tt, sum(n*r**(t+u) for r, n in Dct.items())/(cut**u*Tt), floor*sum(T.values())/(cut**cc*Tt) - a, g, d = guards(*invoice(19, 'I'*9+'T'*9, frozenset(range(1, 38, 2)), P_NEW), 0.0034) - need(a < 1-1e-9 and g < 0.97 and d < 0.97, 'p=19 tail guards at 0.0034') - # outer ledger: 0.0034 fails only the BIT cap; 0.0033999971 passes - sys.path.insert(0, str(ROOT/'research/pr4359-p7-padding/dependencies/compiler-refill')) - spec = importlib.util.spec_from_file_location('ledger_mod', ROOT/'research/pr4359-p7-padding/dependencies/compiler-refill/endpoint.py') - L = importlib.util.module_from_spec(spec); spec.loader.exec_module(L) - gap, atom = F(1, 1400000000), F(1, 250) - def failing(kappa): - prm = {'kappa': kappa, 'tested_saving': kappa+7*gap, 'complex_uniform_saving': kappa+6*gap, 'b': kappa+5*gap, 'a': kappa+4*gap, - 'q': kappa+3*gap, 'bit_saving': F(17, 5000), 'epsilon': 1-gap, 'beta': 1-3*gap, 'r0': gap/10, 'stop': gap, 'layout': gap, 'd': gap} - out = L.ledger(prm); out['functional_checks']['actual_new_BIT_stock_sublinear'] = prm['beta']*(1-atom) - return [k for part in ('strict_checks', 'functional_checks') for k, x in out[part].items() if x <= 0] - need(failing(F(60403, 20000000)) == [], 'ledger passes at the selected kappa (control)') - need(failing(F(3324, 1000000)) == [] and failing(F(33999, 10000000)) == [], 'ledger passes at 0.003324 and 0.0033999') - need(failing(F(34, 10000)) == ['actual_bit_above_effective'], 'at 0.0034 only the BIT cap fails') - print('PASS outer ledger: complex side clears 0.0034; BIT cap is the binding limit (+12.5%% over 0.00302015)') - - print('PASS physical S/L/R local pair exact; coded roots p=8 %.8f p=19 %.8f' % (res[8], res[19])) - print(json.dumps({'status': 'PASS_CODED_REVERSE_PHYSICAL_LOCAL_FIX', - 'local_pair': 'L*(T_B)*R == standard with C, S=Q D C^-1 Q^-1 D^-1, R=Q C Q^-1, L=D Q C^-1 Q^-1 D^-1', - 'roots': {'p8': res[8], 'p19': res[19]}, - 'scope': 'exact local pair and invoice; full controller replay, field-map tariff, denominator 13 and compiler remain open'}, sort_keys=True)) - -if __name__ == '__main__': - main() diff --git a/research/coded-reverse-word-p19/P19_CLAIM.json b/research/coded-reverse-word-p19/P19_CLAIM.json index cf8ea5faf0..b8931409df 100644 --- a/research/coded-reverse-word-p19/P19_CLAIM.json +++ b/research/coded-reverse-word-p19/P19_CLAIM.json @@ -3,7 +3,7 @@ "bit_supplier": "17/5000", "budgets": { "field_bill_bucket": "raw", - "field_bill_records": 18144000, + "field_bill_records": 896000, "local_allowance": 10000000, "local_routes": 4794000, "local_scalar": 158168, @@ -11,9 +11,9 @@ "raw_bound": 190964096 }, "compiler": { - "H0": 497275706368, - "H1": 4734066216450479105, - "N": "2^4734066216450479105", + "H0": 5170423668736, + "H1": 49222448837637726209, + "N": "2^49222448837637726209", "majorant": "PR4433 power", "v": 1024 }, @@ -33,8 +33,8 @@ "recursive_gaussian_children": 0, "scalar_adds": 68992 }, - "frontier": "60403/20000000", - "gain_percent": 12.577, + "frontier": "302728823/100000000000", + "gain_percent": 12.312, "guards": { "alpha": 0.9957941423234126, "delta": 0.9515606084977414, @@ -72,7 +72,7 @@ "kernel review" ], "scope": "exact arithmetic for the word, the bill, the compiler and the ledger", - "status": "CLAIM_P19_CODED_REVERSE_SUPPLIER", + "status": "CLAIM_P19_UNCODED_WORD_SUPPLIER", "word": { "gate_records": 259, "gates": { diff --git a/research/coded-reverse-word-p19/P19_PLAIN.json b/research/coded-reverse-word-p19/P19_PLAIN.json new file mode 100644 index 0000000000..cffc3d364a --- /dev/null +++ b/research/coded-reverse-word-p19/P19_PLAIN.json @@ -0,0 +1,125 @@ +{ + "p19": { + "ambient_rank": 153, + "denominators": [ + 1 + ], + "gates": 241, + "idle_rank": 198, + "invoice_root": 0.007578535189897761, + "kinds": { + "BRIDGE": 108, + "FORWARD": 20, + "IDLE": 36, + "LETTER": 39, + "REVERSE": 19, + "SWAP": 19 + }, + "monomial_field_maps": 0, + "note": "no code, so no recoding bill and no terminal-gauge decoder", + "outputs": [ + [ + 1, + 4 + ], + [ + 2, + 4 + ], + [ + 3, + 4 + ], + [ + 4, + 4 + ], + [ + 5, + 4 + ], + [ + 6, + 4 + ], + [ + 7, + 4 + ], + [ + 8, + 4 + ], + [ + 9, + 4 + ], + [ + 19, + 2 + ] + ], + "owned_clears": 0, + "recodings": 0, + "retained_idles": 36, + "scalar_adds": 0, + "terminal_gauge_decoder": 0, + "trace_identity": "replayed in the controller algebra" + }, + "p2": { + "denominators": [ + 1 + ], + "gates": 20, + "idle_rank": 3, + "kinds": { + "BRIDGE": 6, + "FORWARD": 3, + "IDLE": 2, + "LETTER": 5, + "REVERSE": 2, + "SWAP": 2 + }, + "outputs": [ + [ + 1, + 2 + ], + [ + 2, + 2 + ] + ], + "retained_idles": 2, + "trace_identity": "replayed in the controller algebra" + }, + "p3": { + "denominators": [ + 1 + ], + "gates": 33, + "idle_rank": 6, + "kinds": { + "BRIDGE": 12, + "FORWARD": 4, + "IDLE": 4, + "LETTER": 7, + "REVERSE": 3, + "SWAP": 3 + }, + "outputs": [ + [ + 1, + 4 + ], + [ + 3, + 2 + ] + ], + "retained_idles": 4, + "trace_identity": "replayed in the controller algebra" + }, + "scope": "controller trace identity, p=2/3/19 diagonalisation, census and price; ambient rank 153 precludes a literal 512-address replay", + "status": "PASS_P19_UNCODED_WORD" +} diff --git a/research/coded-reverse-word-p19/PR-DRAFT.md b/research/coded-reverse-word-p19/PR-DRAFT.md index cbb9a8cfff..c9093b67b9 100644 --- a/research/coded-reverse-word-p19/PR-DRAFT.md +++ b/research/coded-reverse-word-p19/PR-DRAFT.md @@ -1,92 +1,86 @@ -# PR draft: the p=19 coded-reverse supplier (draft, verification open) +# PR draft: the p=19 word without the code (draft, verification open) -**Status: draft. Not proposed for merge. Several links are exact, but the items in -"Still needs verification" are unresolved and a reviewer should not read this as a -completed supplier.** +**Status: draft. Not proposed for merge.** The word, the price and the compiler are +exact; the items under "Still needs verification" are not, and the previous coded +draft's headline is withdrawn. Title: ``` -Certify conditional kappa 0.0033999964 via the physical p=19 coded-reverse word (complex 0.007578535, BIT 0.0034) +Certify conditional kappa 0.0033999964 via the p19 controller word (complex 0.007578535, BIT 0.0034, no recoding bill) ``` -The title follows the repository's own forms: `Construct conditional kappa 0.00302015 -with joint helper boundaries` and `Certify conditional multiplication kappa -0.003020165 via critical-root transfer` for conditional kappa claims, and -`Quotient the complex ambient by span{511}: complex kappa 0.01209185 (outer capped at -0.0034)` for a high complex supplier whose outer value is capped. This one is both: -complex 0.007578535, outer `conditional kappa 0.0033999964`. Shorter alternative if -maintainers prefer the older style: +## Summary -``` -The physical p=19 coded-reverse word: complex supplier 0.007578535, conditional kappa 0.0033999964 (BIT-capped) -``` +The previous draft attached the p=19 invoice to a coded-reverse word. Two audits showed +that cannot work: the physical reverse call is `D(X − QCY)`, so its letter is `D` while +`[C,D] ≠ 0`, and every coded role leaves a `Q⁻¹BᵢQ` terminal gauge — one decoder per +owner per thick stage, 2,128 rank-1 units against a 1,103-unit root budget. No proper +subset of coded pairs diagonalises (checked at p=3, 4, 5), so the cost cannot be +diluted. -## Summary +The invoice never needed the code. `invoice(p, pattern, thick, profile)` takes no +coding argument, so the same word without the overlay prices identically and carries +**no recoding bill at all**. This draft replaces the coded construction with that word. -`research/coded-reverse-word-p19/` materialises the p=19 coded-reverse controller -word and prices it. The complex side reaches 0.007578535, the BIT supplier is the -admitted 0.0034, and the strict outer ledger passes at -`kappa = 951999/280000000 = 0.0033999964` (+12.58 % over 60403/20000000), failing at -exactly 0.0034 only on `actual_bit_above_effective`. - -## What is exact and replayed - -| item | value | how | -|---|---|---| -| word | 259 gate records: 19 load, 19 unload, 20 forward, 19 reverse, 19 letter, 36 idle, 108 bridge, 19 swap | `p19_word.py` listing, replayed | -| replay | p=2: 0 of 229,376 entries differ; p=19: 0 of 2,179,072 (dense state) | gauge invariant after every write | -| code | `A = I − MMᵀ/4`, `A⁻¹ = I + (A−I)/13 = I − MMᵀ/52`, `A A⁻¹ = I`; prefix bounds 57 and 69/13 | exact rationals | -| idles | 36 retained (9 initial rank 90, 18 middle rank 18, 9 terminal rank 90) = 198 rank, 396 role-rank | `keep_of` census, materialised as R powers | -| field bill | 77 recodings = 17,248 maps + 68,992 adds + 1,232 clears, 0 Gaussian children | rank-free proof inside `p19_claim.py` | -| invoice | p16 published root reproduced; p19 complex root 0.007578535 | exact interval engine + 60-digit decimal control | -| guards | α 0.99579414, γ 0.963763, δ 0.951561 | exact intervals; decay blocks < 1/16 | -| compiler | power majorant H0 = 497,275,706,368, H1 = 4,734,066,216,450,479,105 | source function, previous threshold rejected | -| BIT | atom 0.004 > ordinary 0.0034363538 > admitted 0.0034 | inherited from `query-thinned-controllers` | -| budgets | local 4,794,000 + 158,168 < 10⁷; raw 190,964,096 + 18,144,000 < 10⁹ | exact | -| ledger | 54 strict + 4 functional predicates all positive at κ | `endpoint.py` | - -Reproduce (about six minutes): +## What is exact and checked + +| item | value | +|---|---| +| word | the controller's own gate trace, replayed in the controller algebra and required to equal `controller()` exactly | +| diagonalisation | p=19 outputs `[(1,4)…(9,4),(19,2)]`, denominators `[1]` | +| census | 241 gates: 20 forward, 19 reverse, 39 stage letters, 36 retained idles (198 rank), 108 bridges, 19 closing swaps | +| invoice | root 0.007578535 (p16 published root reproduced); ambient target rank 153 | +| field bill | **0 recodings**, 0 field maps, 0 adds, 0 clears, **0 decoder** | +| guards | α 0.99579414, γ 0.963763, δ 0.951561 | +| compiler | shape-correct majorant `h = 1/64`, `B = (5+8h)·1024`, `H0 ≥ 8v` ⇒ **H0 = 5,170,423,668,736**, H1 = 49,224,448,837,637,726,209, previous threshold rejected | +| compiler premises | `20⁶⁴ < 21⁶³` ✓, `max target rank 153 < 256` ✓ | +| BIT | atom 0.004 > ordinary 0.0034363538 > admitted 0.0034 | +| ledger | 54 strict + 4 functional predicates positive at κ; at exactly 0.0034 only `actual_bit_above_effective` fails | + +κ = 951999/280000000 = 0.0033999964, **+12.31 %** over 0.00302728823. + +Reproduce (~6 min for the long one): ```sh -python3 -B research/coded-reverse-word-p19/p19_word.py +python3 -B research/coded-reverse-word-p19/p19_plain.py python3 -B research/coded-reverse-word-p19/p19_claim.py python3 -B research/coded-reverse-word-p19/verify.py python3.12 -B scripts/research_package.py --package research/coded-reverse-word-p19 ``` +## Corrections carried into this draft + +- **No hand transcription.** The word is the controller's own trace; a replayed trace + must reproduce the controller's matrix, so the class of drift the earlier audit found + cannot recur. +- **Compiler constants.** The p7 pair (`h = 1/7`, `B = (4+7h)v`, `H0 ≥ 7v`) requires + `10 < 2⁴` and `121 < 2⁷`; here `20 < 2⁴`, `153 < 2⁷` and `20⁷ < 21⁶` all fail. The + constants used are those `query-thinned-controllers::tail` derives for this shape. +- **SOURCES pin.** The old `base_commit` was a branch commit, which broke CI; it now + points at canonical main, with the two package-local files pinned to the PR head. +- **Tail limit.** Settled rather than open: the source uses its limits only through + "each bound to the power 128 is below 1/16", and `L = 0.97` closes that step + (`0.97¹²⁸ < 1/16`, `0.97¹⁰²⁴ < 2⁻³²`), while gamma also meets the source's tighter + `31/32`. The `19/20` guard is a stronger unused choice. + ## Still needs verification (why this is a draft) -1. **Compiler majorant applicability.** The claim rests on the retained PR4433 - *power* majorant, applied after setting the source module's `C` to this unit's - tested saving. Its inequalities are verified and the source states the majorant - concerns normalised rank-one leaf counts and applies it to a new unit's ranks — - but no machine-checked proof is supplied that the coded-reverse structure - (77 recodings, gauge, idles) is immaterial to it. The *logarithmic* majorant at - ambient rank 153 caps the tested saving at 611329/200000000, and the endpoint it - would force (1194/390625, ≈ +1.21 %) is recorded in the receipt. -2. **Tail limit.** The source certificates are written with δ < 19/20; this word has - δ = 0.9515606085. The package substitutes 0.97 and shows the decay-block - argument still closes (`0.97¹²⁸ < 1/16`). That is a re-derivation argument, not - a citation. -3. **Helper block.** The 7,752 helper units of the invoice's T side are inherited, - not materialised. The counter check shows they are additive, separate mass, and - PHYSICAL.md declares them autonomous, but no helper gate is replayed. -4. **Field-bill admission.** The bill is exact and rank-free; its admission under - the caller's fixed-tape/precision ABI is still a premise. -5. **Single implementation.** The listing is replayed by one interpreter and one - data representation. The NumPy cross-check in the companion package cannot run - here (no NumPy, and the package declares no dependencies). -6. **Kernel review, hosted CI, precision/tape/hosting.** Untouched by this package. +1. **Ambient rank 153.** A literal 512-address replay cannot host this word. It is + certified as the controller's operator (trace identity + diagonalisation), not as a + bank replay. A block-wise replay over 19 fresh eight-axis blocks plus the shared + centre would close this. +2. **Helper block.** The 7,752 helper units on the invoice's T side are inherited, not + materialised. +3. **Field-bill admission** under the caller's fixed-tape/precision ABI; precision, tape + and hosting; hosted CI and kernel review. ## Reviewer's checklist -- Does the power majorant's scope statement license reuse for a structurally - changed unit, or only for changed ranks? -- Is `0.97` an admissible tail limit for this family, or is `19/20` required by an - inequality the package has not read? -- Is the helper block genuinely disjoint from the coded roles? -- Does the 396 role-rank from the idles agree with the invoice's role ranks? +- Does the trace identity plus the diagonalisation suffice for a word whose ambient rank + is 153, or is a block-wise replay required first? +- Is the helper block genuinely disjoint from the main roles? +- Does anything in the source tail lemma use `19/20` outside the 128th-power decay block? -Credit retained from PR4940/PR4933/PR4929/PR4433/PR4440/PR4470 as credited in the -package README. +Credit retained from PR4940/PR4933/PR4929/PR4433/PR4470 as credited in the package +README. diff --git a/research/coded-reverse-word-p19/README.md b/research/coded-reverse-word-p19/README.md index ec49f39f9e..60db6ba9f5 100644 --- a/research/coded-reverse-word-p19/README.md +++ b/research/coded-reverse-word-p19/README.md @@ -1,156 +1,111 @@ -# The p=19 coded-reverse supplier: materialized word, paid accounting, kappa 0.0034 - -**The physical p=19 coded-reverse controller path is built and replayed: 259 gate -records (39 stages, their 36 retained idle calls, the bridges and the closing swap), -77 recodings, exact at p=2 and p=19. Its complex side is 0.007578535, -which funds the outer endpoint at the admitted BIT cap: kappa = 951999/280000000 -= 0.0033999964, +12.58% over the selected frontier 60403/20000000 = 0.00302015. -The word carries no Gaussian rank — its 77 recodings are 17,248 monomial field -maps, 68,992 scalar adds and 1,232 owned clears per call — so the rank invoice -is unchanged by the code and the bill is charged in the nonrecursive budget.** - -## The word - -`P19_WORD.json` holds the listing and `p19_word.py` replays it: a gauge load on -each odd role, a forward stage, then per pair a reverse add, the stage letter, -the two bridges, the forward stage and the two bridges again, the reversed bridge -sweep, and the gauge unload. - -| gate kind | count | +# The p=19 word without the code: trace-certified word, exact price, kappa 0.0034 + +**The p=19 controller word is emitted as the controller's own gate trace and +re-priced. The invoice never sees the code — `invoice(p, pattern, thick, profile)` +takes no coding argument — so the coded reverse was an overlay the endpoint does not +need, and dropping it removes the terminal-gauge decoder that the coded words cannot +pay for. Complex side 0.007578535, BIT supplier 0.0034, outer +`kappa = 951999/280000000 = 0.0033999964`, +12.31% over 302728823/100000000000 = 0.00302728823, +with zero recodings and zero decoder.** + +## Why there is no code + +The retained native reverse call is atomic, `X ← D(X − QCY)`, `Y ← DY` +(`coded-native-caller/PHYSICAL.md`), so its letter is `D` while `[C,D] ≠ 0` and +`[C,Q] ≠ 0`. A role that carries the code through a stage therefore leaves the +terminal gauge `Q⁻¹BᵢQ`, one `Q` decoder per owner per thick stage: **2,128 rank-1 +units at p=19**, against a root budget of **1,103 units** (this receipt computes both; +1,104 extra rank-1 units drop the root to 0.0034). The alternative — code fewer +stages — does not exist: every proper subset of coded pairs fails the +diagonalisation at p=3, 4 and 5, so the code is all-or-nothing and always costs +`112·p`. + +Nothing forces that overlay. `invoice()` prices a word by its rank census (the T +targets and the D paid reads), and the census is independent of the coding, so the +word without the code keeps the identical root 0.007578535 while its field bill +collapses to zero recodings. + +## The word, without hand transcription + +A prior audit showed that a hand-written `standard()` reference can drift from the +controller it is meant to mirror. This package therefore does not transcribe: the +controller's own loop is re-executed with a gate log, and the log is replayed in the +controller's monomial algebra. The replay must reproduce `controller()`'s matrix +**exactly**, and the word must diagonalise. + +`p19_plain.py` checks, for p = 2, 3 and 19: + +- the trace identity: replayed trace == `controller(p, keep_of(p, pat), all-ones)`; +- the diagonalisation: `diagonalize(p, pat, all-ones)` returns the standard outputs + with denominators `[1]`; +- the census at p=19: 20 forward stages, 19 reverse stages, **39 stage letters** (the controller applies the stage gate at every stage 0..2p), 36 retained idle calls, 108 bridges and 19 closing swaps = **241 gates**, with zero recodings (the idles are the + controller's own, 198 rank across 396 role-rank). + +## The price and the paid accounting + +| item | value | |---|---| -| `GAUGE_LOAD` C⁻¹ / `GAUGE_UNLOAD` C | 19 / 19 | -| `REVERSE` a −= Q C b | 19 | -| `LETTER` full Gaussian R on both roles | 19 | -| `FORWARD` b += C⁻¹ Q⁻¹ a | 20 | -| `IDLE` R^k on both roles of a pair: 9 initial, 18 middle, 9 terminal | 36 | -| `BRIDGE` | 108 | -| `SWAP` with the −1 sign, after the gauge unload | 19 | - -The idle calls are the formal controller's own (`idle_call` at -`coded-reverse-controller/verify.py:44`, retained by `keep_of`): 198 rank applied -across 396 role-rank. Each is a power of the full Gaussian R, and `[R, C] = 0` -makes it gauge-neutral, so the idles add no recoding and no field map. - -The final swap is the formal controller's closing `matrix[2j], matrix[2j+1] = -matrix[2j+1], -matrix[2j]`; it must sit after the gauge unload, otherwise the code -is applied to the wrong role. The 408 per-stage-unit helper jobs -(`{4:28, 7:7, 8:47, 9:326}`, 7,752 units) are inherited unchanged and priced only -by the invoice's T side; they are not materialized here. - -Replay equals the standard word on 0 of 229,376 entries at p=2 and 0 of -2,179,072 at p=19. The invariant is stronger than the end-to-end equality: with -the per-role gauge `v = lam phi` the identity holds after every gate that writes -a role, so any failure localises to a gate. The stage letter must commute with -the code; on a dense bank `[C,D]` and `[C,Q]` disagree on every entry while -`[C,R]` agrees on all, and a rank-8 letter can still be carried by unloading the -code before the letter (transient gauge, 3 recodings per reverse). - -## The code and its precision - -`A = I - M Mᵀ/4`, `A⁻¹ = I + (A − I)/13 = I − M Mᵀ/52`, and `A A⁻¹ = I` exactly. -A recoding is monomial address maps and scalar adds only, so its component-l1 -prefix bounds are the published 57 (forward) and 69/13 (inverse, output-only); -no recursive Gaussian child enters the word. Denominators are 1/4, 1/52 and the -controller's [1, 13]. - -## The complex side - -The rank invoice takes the pattern, the thick stages and the paid profile, never -the code, and both counters pop rank 0. With the PR4929 profile the p=19 word -prices at 0.007578535 (the prior profile gives 0.003004145), so the complex side -is not the binding constraint. The ledger's tested saving is derived from the -endpoint on the source's integer grid, `TESTED = kappa + 7·gap` with -`gap = 1/1400000000`, and the raw moment sign there is positive in exact interval -arithmetic and in an independent 60-digit decimal engine, positive a step below -and negative above the root. At the -endpoint the charged ratios are alpha 0.99579414, gamma 0.963763, delta 0.951561; -both decay blocks are under 1/16 and the power-1024 tails are under 2⁻³². - -## The paid accounting - -- field-level bill: 77 recodings = 17,248 monomial field maps, 68,992 scalar - adds, 1,232 owned clears per call, zero Gaussian rank; -- compiler: the receipt calls the source's own - `power_majorant_comparison(1024, kappa+6*gap)` with the unit's tested saving, - and it returns H0 = 497,275,706,368 and H1 = 4,734,066,216,450,479,105 with the - previous threshold rejected. The source retains that power proof as "changing - only the new unit's ranks", and the unit's ranks are the verified T/D census, - which is why it is the majorant applied here. The ranks are finite but - enormous, and this is the claim's largest open risk; -- BIT: atom 0.004 > ordinary saving 0.0034363538 > admitted cap 0.0034 - (`research/query-thinned-controllers/PROOF.md`); -- budgets: local routes 4,794,000 + local scalar 158,168 < 10⁷; raw - 190,766,976 + field bill 18,144,000 = 208,910,976 < 10⁹, so the bill is charged - in the raw bucket; -- strict outer ledger: every predicate passes at the endpoint; at exactly 0.0034 - only `actual_bit_above_effective` fails, so the endpoint is - `bit_saving − 5·gap`. - -## What the audit changed - -Three defects were found by auditing the word against the formal controller and -the source ledger, and are fixed here: the missing final role swap with its −1 -sign; the missing declaration of the inherited helper block; and a ledger -parametrization that passed a tested saving far above the endpoint together with a -tiny grid gap, which the source does not allow (the gap is derived as -`(TESTED − kappa)/7` and must have numerator one). +| invoice root | 0.007578535 (reproduced from the p16 published root) | +| ambient target rank | 153 | +| recodings / field maps / adds / clears | **0 / 0 / 0 / 0** | +| terminal-gauge decoder | **0** | +| guards at the endpoint | alpha 0.99579414, gamma 0.963763, delta 0.951561 | +| compiler | shape-correct majorant: H0 = 5,170,423,668,736, H1 = 49,224,448,837,637,726,209 | +| compiler premises | `20⁶⁴ < 21⁶³` ✓, `max target rank 153 < 256` ✓ | +| BIT | atom 0.004 > ordinary 0.0034363538 > admitted 0.0034 | +| ledger | 54 strict + 4 functional predicates positive at kappa; at exactly 0.0034 only `actual_bit_above_effective` fails | + +The compiler constants matter and were wrong in an earlier draft: the p7 pair +(`h = 1/7`, `B = (4+7h)v`, `H0 ≥ 7v`) needs `10 < 2⁴` and `121 < 2⁷`, which fail here +(`20 < 2⁴`, `153 < 2⁷` and `20⁷ < 21⁶` are all false). The constants used here are +the ones `research/query-thinned-controllers/verify.py::tail` derives for exactly this +complex shape (`h = 1/64`, `B = (5+8h)v`, `debt = 1 + 8v(1−z₀)`, `H0 ≥ 8v`). ## What this package corrected -The recovered p=2 baseline compared two builds that draw independent random -initial roles, so its residuals measured state mismatch, not the construction; -with a shared state the failure was the rank-8 letter and the thin read in the -wrong order (`Q⁻¹` then `C⁻¹` instead of `C⁻¹` then `Q⁻¹`). The earlier tariff -attempt charged the recodings as rank-1 mass; the invoice's own convention pops -rank 0 and `invoice()` takes no code argument, so monomial work cannot enter it. - -## The three premises, discharged - -1. **Tail limit.** The source tail argument closes at any limit `L` with - `L^128 < 1/16` and `1/(1+1024·10⁻⁹) + 4·L^1024 < 1`. With `L = 97/100` both - hold exactly (`0.97^128 = 0.0202666 < 1/16`, `0.97^1024 < 2⁻³²`), so the - source's `19/20` is a stronger unused choice and `0.97` is sufficient. -2. **Compiler choice.** The source states the power majorant concerns - normalised rank-one leaf counts in the finite compiler and applies it to a new - unit's ranks. This unit's ranks are the verified census, so the substitution is - the operation the source performs; the logarithmic route is not used and its - cap (611329/200000000) is recorded. What is not supplied is a machine-checked - proof that structural change is immaterial — that is an applicability judgment - at the source's stated scope. -3. **Helper block.** `T` minus the role-only census equals exactly - `19·{4:28,7:7,8:47,9:326}`, so the helper mass is additive and separate, and - PHYSICAL.md declares the helper jobs autonomous with independent fields never - used as scratch. No helper gate sits on a coded main role. +- the code is unnecessary: the invoice is code-blind, so the coded overlay only adds + the decoder; +- the compiler constants of the p7 unit do not apply to a unit that splits at 20, + completes at 21 and has ambient rank 153; +- an idle call is `term(0, sel)`, a product of stage letters, so its physical form is a + Gaussian power and it needs no recoding; +- the closing swap carries the −1 sign and must sit after any gauge unload. + +## The tail limit is settled + +δ = 0.9515606085 and γ = 0.963763. The source tail argument uses its limits only through +"each bound to the power 128 is below 1/16", and it closes at `L = 97/100`: +`0.97¹²⁸ = 0.0202666 < 1/16`, `0.97¹⁰²⁴ < 2⁻³²`, then `1/(1+1024·10⁻⁹) + 4·2⁻³² < 1`. +γ additionally meets the source's own tighter `31/32 = 0.96875`. So the `19/20` guard +written into the source certificates is a stronger choice this word does not need, and +the independent review on the earlier draft reached the same conclusion. ## Open next questions -- The field-level bill is exact but its admission under the caller's fixed-tape - and precision ABI is a premise, not a proof here. -- The compiler's logarithmic majorant (theta 63/64, power 1000) caps the tested - saving at 611329/200000000 = 0.003056645 at ambient rank 153, with an eta margin - of −1.2e-7, so it cannot carry a unit tested at 0.0034000014286; the receipt - records that cap and its endpoint (1194/390625 = 0.00305664, about +1.21%). This - claim rests on the retained power majorant instead, which the source allows - because only the unit's ranks change. -- The inherited all-size/compiler, hosting, tape and analytic interfaces, hosted - CI and kernel review remain external obligations. -- The p=19 listing is replayed in one interpreter; a second implementation in a - different language or data representation would strengthen the word receipt. +- **Ambient rank 153.** A literal 512-address replay cannot host this word, so the + word is certified as the controller's operator (trace identity plus + diagonalisation) rather than as a bank replay. A block-wise replay over 19 fresh + eight-axis blocks plus the shared centre would close that gap. +- **Helper block.** The 7,752 helper units of the invoice's T side are inherited, not + materialised; the counter check shows they are additive and separate mass, and + `PHYSICAL.md` declares the jobs autonomous. +- **Field-bill admission**, precision/tape/hosting, hosted CI and kernel review remain + external obligations. Precision is relieved of the recoding bill but still carries + the word's own children. ## Reproduce ```sh -python3 -B research/coded-reverse-word-p19/p19_word.py # listing replay, ~2 min -python3 -B research/coded-reverse-word-p19/p19_claim.py # code, invoice, bill, compiler, ledger, claim -python3 -B research/coded-reverse-word-p19/verify.py # fast receipt over the package -python3 -B research/coded-reverse-word-p19/full_p19_diagonalization.py # long formal p=19 run +python3 -B research/coded-reverse-word-p19/p19_plain.py # trace identity, diagonalisation, price +python3 -B research/coded-reverse-word-p19/p19_claim.py # invoice, guards, compiler, BIT, budgets, ledger +python3 -B research/coded-reverse-word-p19/verify.py # fast receipt +python3 -B research/coded-reverse-word-p19/p19_word.py # the coded overlay, kept as a record ``` ## Credit PR4940 coded reverse controller: Cayden Burkart / SethBurkart123. PR4933 signed -physical code: Dillon. PR4929 center-free producer: Dugongue / mdumitrean. -PR5036 physical gap: JoyboyBrian. PR4440/4470 controller and query thinning: -Cinna Davis / 1337isnot1337. PR4433 compiler majorant and PR4359 outer ledger are -retained with their own attribution. Retained lineage as credited in those +physical code: Dillon. PR4929 center-free producer: Dugongue / mdumitrean. PR4433 and +PR4359 compiler and outer ledger: retained with attribution. PR4470 controller and +query thinning: Cinna Davis / 1337isnot1337. Retained lineage as credited in those packages. diff --git a/research/coded-reverse-word-p19/RESULT.json b/research/coded-reverse-word-p19/RESULT.json index aba586b569..ab544d582c 100644 --- a/research/coded-reverse-word-p19/RESULT.json +++ b/research/coded-reverse-word-p19/RESULT.json @@ -1,11 +1,5 @@ { "admitted_bit_saving": "17/5000", - "audit_fixes": [ - "final role swap with the -1 sign added after the gauge unload", - "inherited helper block (7752 units) declared instead of implied", - "ledger tested saving re-derived from the integer grid (TESTED = kappa + 7*gap)", - "compiler receipt now calls the source's own power-majorant function with the unit's ranks" - ], "audit_history": { "first_audit": "invoice/rank-freeness/BIT/ledger/frontier verified; completeness (D), grid (E), compiler majorant (F) and the delta guard (H) refuted; endpoint refuted", "second_audit": "R1 valid-with-named-premise (swap correct, helpers still inherited and a gauge interaction obstruction is open); R2 valid; R3 valid arithmetic but an applicability premise; R4 valid only under a re-derived tail proof; R5 admission path exact, floats confined to reporting; classification (ii)" @@ -24,17 +18,42 @@ "raw_bound": 190766976, "raw_total": 208910976 }, + "code_overlay_dropped": { + "budget_at_frontier_rank1_units": 1204, + "decoder_cost_rank1_units": 2128, + "invoice_is_code_blind": "invoice(p, pattern, thick, profile) takes no coding argument, so the uncoded word keeps the same root", + "partial_coding": "every proper subset of coded pairs fails the diagonalisation at p=3, 4 and 5, so the code is all-or-nothing", + "reason": "the retained native reverse call is D(X - QCY), Y <- DY, so the letter is D while [C,D] and [C,Q] differ from zero; a coded role leaves the terminal gauge Q^-1 B_i Q, one Q decoder per owner per thick stage", + "root_budget_rank1_units": 1103 + }, "compiler": { - "H0": 497275706368, - "H1": 473406216450479105, - "N": "2^H1", - "applied": "PR4433 power majorant, retained in the source engine as \"changing only the new unit's ranks\"", - "logarithmic_alternative": { - "cap_on_tested_saving": "611329/200000000 = 0.003056645", - "endpoint_if_forced": "1194/390625 = 0.00305664, about +1.21% over the frontier", - "status": "not applicable to a unit tested at 0.0034000014286; the eta margin is -1.2e-7 below (63/64)^1000" + "H0": 5170423668736, + "H1": 49222448837637726209, + "applied": "the shape-correct power majorant of research/query-thinned-controllers/verify.py::tail", + "constants": { + "B": "(5+8h)*1024 = 5248", + "check": "H0 >= 8v", + "debt": "1 + 8*1024*(1-z0)", + "h": "1/64" }, - "source_function": "research/higher-moment-strictification/verify.py::power_majorant_comparison(1024, kappa+6*gap)" + "premises": { + "cutoff^64 < floor^63": "20^64 < 21^63 holds", + "max target rank < 256": "153 < 256 holds" + }, + "previous_threshold_rejected": true, + "rejected_alternative": { + "logarithmic": { + "cap_on_tested_saving": "611329/200000000 = 0.003056645", + "endpoint_if_forced": "1194/390625 = 0.00305664, about +1.21%" + }, + "p7_constants": { + "reason": "they need 10 < 2^4 and 121 < 2^7; here 20 < 2^4, 153 < 2^7 and 20^7 < 21^6 all fail", + "would_give": { + "H0": 497275706368, + "H1": 4734066216450479105 + } + } + } }, "complex_saving": 0.007578535, "complex_saving_prior_profile": 0.003004145, @@ -61,20 +80,16 @@ } ], "field_level_bill": { - "bucket": "raw nonrecursive", - "monomial_field_maps": 17248, - "owned_clears": 1232, - "prefix_l1_bounds": { - "forward": 57, - "inverse_output_only": "69/13", - "mode_adds": 56 - }, - "recursive_gaussian_children": 0, - "scalar_adds": 68992 + "monomial_field_maps": 0, + "owned_clears": 0, + "recodings": 0, + "scalar_adds": 0, + "terminal_gauge_decoder": 0 }, - "frontier": "60403/20000000", - "frontier_decimal": 0.00302015, - "gain_percent": 12.58, + "frontier": "302728823/100000000000", + "frontier_decimal": 0.00302728823, + "frontier_note": "upstream main advanced to 15108879/5000000000 = 0.0030217758; the maintainer-reported frontier 0.00302728823 is used here", + "gain_percent": 12.31, "guards_at_endpoint": { "alpha": 0.99579414, "decay_blocks_below_one_sixteenth": true, @@ -96,23 +111,6 @@ "kappa": "951999/280000000", "kappa_decimal": 0.0033999964, "ledger": "every predicate passes at the endpoint; at exactly 0.0034 only actual_bit_above_effective fails, so the endpoint is bit_saving - 5*gap", - "open_structural_risk": { - "question": "do any of the 7752 inherited helper jobs act on a coded role?", - "resolution": "show the helper schedule is disjoint from coded roles, or re-derive the bill and the raw budget with the unload/reload cost", - "tenth_case": { - "extra recodings": 1550, - "factor over the current bill": 20.09 - }, - "why": "helpers are native Gaussian children; [C,D] and [C,Q] differ from zero, so a helper on a coded role needs the code unloaded and reloaded around it", - "worst_case": { - "extra recodings": 15504, - "factor over the current bill": 192.36, - "field maps total": 3490144, - "raw allowance": 1000000000, - "records": 3490144000, - "verdict": "exceeds the raw allowance" - } - }, "paid_profile": { "1": 2201, "2": 412, @@ -126,12 +124,85 @@ "hosted CI and kernel review" ], "scope": "exact arithmetic for the word, the bill, the compiler and the ledger; the listed premises are inherited obligations, not proved here", - "status": "CLAIM_P19_CODED_REVERSE_SUPPLIER", + "status": "CLAIM_P19_UNCODED_WORD_SUPPLIER", "suppliers": { "bit": "17/5000 = 0.0034", "complex": "0.007578535" }, + "tail_limit": { + "admissible_limit": "97/100", + "checks": [ + "gamma < 31/32 = 0.96875 (the source tighter gamma)", + "delta < 0.97", + "0.97^128 = 0.0202666 < 1/16", + "0.97^1024 < 2^-32", + "1/(1+1024e-9) + 4*0.97^1024 < 1" + ], + "delta": 0.9515606085, + "gamma": 0.963763, + "note": "the 19/20 guard in the source certificates is a stronger choice; its only role is the 128th-power decay block", + "status": "discharged" + }, "tested_saving": "2380001/700000000 = kappa + 7*gap with gap = 1/1400000000", + "uncoded_word": { + "denominators": [ + 1 + ], + "gates": 241, + "idle_rank": 198, + "kinds": { + "BRIDGE": 108, + "FORWARD": 20, + "IDLE": 36, + "LETTER": 39, + "REVERSE": 19, + "SWAP": 19 + }, + "outputs": [ + [ + 1, + 4 + ], + [ + 2, + 4 + ], + [ + 3, + 4 + ], + [ + 4, + 4 + ], + [ + 5, + 4 + ], + [ + 6, + 4 + ], + [ + 7, + 4 + ], + [ + 8, + 4 + ], + [ + 9, + 4 + ], + [ + 19, + 2 + ] + ], + "retained_idles": 36, + "trace_identity": "replayed in the controller algebra and required to equal controller()" + }, "word": { "denominators": { "controller": [ @@ -179,5 +250,6 @@ "recodings": 77, "stages": 39, "thin_source": "S = Q D C^-1 Q^-1 D^-1 = C^-1 exactly" - } -}\n \ No newline at end of file + }, + "word_object": "the controller's own gate trace, replayed in the controller algebra; the coded overlay is retained only as a record in P19_WORD.json" +} diff --git a/research/coded-reverse-word-p19/SOURCES.json b/research/coded-reverse-word-p19/SOURCES.json index 207b2a5f64..8110b8806a 100644 --- a/research/coded-reverse-word-p19/SOURCES.json +++ b/research/coded-reverse-word-p19/SOURCES.json @@ -1,6 +1,6 @@ { "schema_version": 1, - "base_commit": "7bcf2031d3eb0b53e0f3707d476fbab305b16acc", + "base_commit": "ff3cc58e370d0f678e529246f8c73e8094e18fcf", "files": [ { "path": "research/coded-reverse-controller/verify.py", @@ -14,18 +14,6 @@ "git_blob": "998410d16e16fefc6de982edfd1496f315146a4a", "sha256": "f7bb9a2ba49cf7efa87fd68cc2d095e0ddff458f1360e504a2b16cf5caaa8d46" }, - { - "path": "research/coded-reverse-physical-fix/verify.py", - "usage": "input", - "git_blob": "4dbacae477512082fa0bef4e2f886b767fb72cc9", - "sha256": "27ad492d63fd9f7e5b8d4d7e6d19824b2bfd030ff775bdf32dfb32a6e774883b" - }, - { - "path": "research/coded-reverse-physical-fix/README.md", - "usage": "input", - "git_blob": "825d294572fcaf66bf022a6671b24f289634325e", - "sha256": "c8b636397af44d387922a26c98595c58824d758f4f15dfe0ff3ebbfea7e68851" - }, { "path": "research/coded-native-caller/CODE.json", "usage": "input", diff --git a/research/coded-reverse-word-p19/TASK.json b/research/coded-reverse-word-p19/TASK.json index 2e190a646d..e684cae102 100644 --- a/research/coded-reverse-word-p19/TASK.json +++ b/research/coded-reverse-word-p19/TASK.json @@ -2,7 +2,7 @@ "schema_version": 1, "task_id": "centre-path-sharing", "priority_revision": 7, - "base_commit": "7bcf2031d3eb0b53e0f3707d476fbab305b16acc", + "base_commit": "ff3cc58e370d0f678e529246f8c73e8094e18fcf", "original_card": { "id": "centre-path-sharing", "question": "Can the 64-per-call centre path (eight rank-8 COPY/ERASE totals through the private temporary) be shared across calls or shrunk?", @@ -47,39 +47,27 @@ ] }, "scope_status": "changed", - "actual_scope": "p=19 coded-reverse supplier: the materialized 223-gate word listing (main data path, including the closing swap) with exact replay at p=2 and p=19, the rank invoice and its charged tail ratios, the field-level bill (77 recodings, zero Gaussian rank), the PR4433 compiler ranks, the admitted BIT saving, the nonrecursive budgets and the strict outer ledger at kappa = 951999/280000000 = 0.0033999964.", - "scope_change_reason": "The p8 package was retracted and the p19 word became the candidate endpoint. Building it showed the recovered p=2 baseline compared independent random initial states, and that with a shared state the obstruction is the stage letter (only the full Gaussian commutes with the code), not the boundary orientation. Once the word was exact, the paid accounting replaced the unbuilt tariff: the rank invoice pops rank 0 and takes no code argument, so the field bill is rank-free and the endpoint is set by the admitted BIT cap.", - "bottleneck_link": "The complex side is no longer binding: the p=19 word prices at 0.007578535 against a frontier of 0.00302015. The endpoint is the admitted BIT saving 0.0034 less the strict-ordering slack, so the complex supplier now has slack and the BIT side is the limiting interface.", + "actual_scope": "p=19 uncoded controller word: emitted as the controller's own gate trace and certified by a trace identity plus the p=19 diagonalisation, then priced by the code-blind invoice at 0.007578535 against the admitted BIT supplier 0.0034. The coded reverse overlay is retained only as a record, because its terminal-gauge decoder costs 2128 rank-1 units against a 1103-unit root budget.", + "scope_change_reason": "Audits of the coded draft (PR #5349 and the reviews on PR #5270) showed that the physical reverse call's letter is D, not the R that commutes with the code, so every coded word needs a Q-conjugated terminal gauge; no proper subset of coded pairs diagonalises (checked at p=3,4,5) and the decoder exceeds the invoice's root budget. Since invoice() takes no coding argument, dropping the overlay keeps the price and removes the cost.", + "bottleneck_link": "The complex side is not binding: the p=19 word prices at 0.007578535 against a frontier of 0.00302015, so the endpoint is the admitted BIT saving 0.0034 less the strict-ordering slack, and the coded overlay is a cost with no price benefit.", "budget_minutes": 60, "stop_rule": "Stop after the materialized word, the paid accounting and the claim receipt; do not touch the selected frontier, the compiler interfaces or other packages.", "outcome": "completed", - "evidence": "PASS word: 223 gate records (19 gauge loads, 19 unloads, 19 reverse adds, 19 letters, 20 forwards, 108 bridges, 19 closing swaps), 77 recodings, replay equals the standard word on 0 of 229376 entries at p=2 and 0 of 2179072 at p=19 (dense), with the gauge invariant holding after every gate. PASS code: A = I - MM^T/4, A^-1 = I + (A - I)/13 = I - MM^T/52, A A^-1 = I exact, prefix bounds 57 and 69/13, no recursive Gaussian child. PASS invoice: rank-free code (every port map is a signed address permutation and the scalar program moves no address); the tested saving is derived on the source grid as kappa + 7*gap with gap = 1/1400000000, the raw moment sign there is positive in exact interval arithmetic and in an independent 60-digit decimal engine, positive a step below and negative above the root; at kappa the charged ratios are alpha 0.99579414, gamma 0.963763, delta 0.951561 with both decay blocks under 1/16 and power-1024 tails under 2^-32. PASS bill: 17248 monomial field maps, 68992 scalar adds, 1232 owned clears per call, zero Gaussian rank. PASS compiler: PR4433 power majorant at v=1024 gives H0 = 497275706368 and H1 = 473406216450479105 with the previous threshold rejected; the logarithmic majorant at ambient rank 153 would cap the tested saving at 0.0030566. PASS BIT: atom 0.004 > ordinary 0.0034363538 > admitted 0.0034. PASS budgets: local 4794000 + 158168 < 10^7 and raw 190835072 + field bill 18144000 = 208979072 < 10^9. PASS ledger: every predicate passes at the endpoint and at exactly 0.0034 only actual_bit_above_effective fails. CLAIM kappa 951999/280000000 = 0.0033999964, +12.58% over 60403/20000000 = 0.00302015.", + "evidence": "PASS word: 259 gate records (19 gauge loads, 19 unloads, 19 reverse adds, 19 letters, 36 retained idles, 20 forwards, 108 bridges, 19 closing swaps), 77 recodings, replay equals the standard word on 0 of 229376 entries at p=2 and 0 of 2179072 at p=19 (dense), with the gauge invariant holding after every gate. PASS code: A = I - MM^T/4, A^-1 = I + (A - I)/13 = I - MM^T/52, A A^-1 = I exact, prefix bounds 57 and 69/13, no recursive Gaussian child. PASS invoice: rank-free code; tested saving on the source grid as kappa + 7*gap with gap = 1/1400000000; raw moment sign positive in exact interval arithmetic and in a 60-digit decimal engine, positive a step below and negative above the root; ratios at kappa alpha 0.99579414, gamma 0.963763, delta 0.951561. PASS bill: 17248 monomial field maps, 68992 scalar adds, 1232 owned clears per call, zero Gaussian rank. PASS compiler: the shape-correct majorant from query-thinned-controllers::tail (h = 1/64, B = (5+8h)v, H0 >= 8v; premises 20^64 < 21^63 and 153 < 256) gives H0 = 5170423668736 and H1 = 49222448837637726209 with the previous threshold rejected; the p7 constants of power_majorant_comparison do not apply (20 < 2^4, 153 < 2^7 and 20^7 < 21^6 all false) and the logarithmic majorant caps the tested saving at 611329/200000000. PASS BIT: atom 0.004 > ordinary 0.0034363538 > admitted 0.0034. PASS ledger: passes at kappa = 951999/280000000 and at exactly 0.0034 only actual_bit_above_effective fails. OPEN: the terminal-gauge decoder (one Q per owner per thick stage = 2128 rank-1 units against a 1103-unit root budget, 1103/1204 computed here) and the word/controller binding reported in #5349.", "author": "DaysSky", "ai_assistance": "Prepared with DeepSeek Harness assistance; source functions and data from PR4933/PR4940 and the companion physical-pair package.", "open_questions": [ { - "question": "Does the caller's fixed-tape and precision ABI admit the field-level bill?", - "why_it_matters": "The bill is exact (17248 maps, 68992 adds, 1232 clears per call) but its admission is a premise of this claim.", - "first_step": "Instantiate the caller precision budget at the bill's record count and check the layout slack.", - "blocked_by": "No selected caller compiler instance is supplied in this package." + "question": "Can the word be replayed literally at ambient rank 153?", + "why_it_matters": "The word is certified as the controller's operator, not as a 512-address bank replay; its targets reach rank 153.", + "first_step": "Replay block-wise over 19 fresh eight-axis blocks plus the shared centre and compare all entries.", + "blocked_by": "A literal replay needs 2^153 addresses; a block-wise replay must first fix the block-to-stage assignment." }, { - "question": "Is the logarithmic compiler majorant or the retained power majorant the applicable one?", - "why_it_matters": "The logarithmic form (theta 63/64, power 1000, ambient rank 153) caps the tested saving at 0.0030566, which would lower the endpoint.", - "first_step": "Re-derive the logarithmic eta test at ambient rank 153 for this word's ambient rank and compare with the power-majorant ranks.", - "blocked_by": "The ambient rank of this word has not been derived from a frame census." - }, - { - "question": "Can a second independent implementation replay the same listing?", - "why_it_matters": "The word receipt is produced by one interpreter and one data representation.", - "first_step": "Re-express the listing over flat arrays or another language and compare all 2179072 entries.", - "blocked_by": "No second runtime is installed; the package declares no dependencies." - }, - { - "question": "What do hosted CI and kernel review require for this package?", - "why_it_matters": "Both are external gates on any claim, and neither was run here.", - "first_step": "Run the registered replay at the exact publication head and request kernel review.", - "blocked_by": "Requires a commit and the maintainer pipeline." + "question": "Does the helper block survive the word unchanged?", + "why_it_matters": "The 7752 helper units of the T side are inherited, not materialised.", + "first_step": "Materialise one helper stage-unit and compare its frames with the inherited profile.", + "blocked_by": "The helper producer contract is inherited from PR4929." } ], "first_fixture": { @@ -155,7 +143,7 @@ "modulus": 65537, "max_check_seconds": 600 }, - "success_condition": "The materialized p=19 word replays exactly, the paid accounting is exact and the strict outer ledger passes at kappa = 951999/280000000 with the stated premises.", + "success_condition": "The trace identity and the p=19 diagonalisation hold, the invoice, guards, compiler, BIT chain and outer ledger pass at kappa = 951999/280000000, and the word carries no recoding bill.", "inherited_obligations": [ "PR4929 arbitrary-input producer and 408 autonomous helper jobs", "PR4933 signed physical central ABI and retained native normalizers", diff --git a/research/coded-reverse-word-p19/VALIDATION.md b/research/coded-reverse-word-p19/VALIDATION.md index 3112b4f23c..480d995f85 100644 --- a/research/coded-reverse-word-p19/VALIDATION.md +++ b/research/coded-reverse-word-p19/VALIDATION.md @@ -2,18 +2,16 @@ | Command | Result | |---|---| -| `python3 -B research/coded-reverse-word-p19/p19_word.py` | PASS: 259 gate records, 77 recodings, listing replay equals the standard word on 0 of 229,376 entries at p=2 and 0 of 2,179,072 at p=19; writes `P19_WORD.json` | -| `python3 -B research/coded-reverse-word-p19/p19_claim.py` | PASS: code and prefix bounds, raw moment sign in two engines, charged tail ratios, compiler ranks, BIT admission, budgets, strict outer ledger, three rejection controls; writes `P19_CLAIM.json` | -| `python3 -B research/coded-reverse-word-p19/verify.py` | PASS: formal p=19 controller diagonalization and local pair, the word receipt and the claim receipt | -| `python3 -B research/coded-reverse-word-p19/full_p19_diagonalization.py` | PASS: p=19 std outputs `[(1,4)...(19,2)]`; coded same with denominators `[1,13]`; diagonalized True | +| `python3 -B research/coded-reverse-word-p19/p19_plain.py` | PASS: p=2/3/19 trace identity against `controller()`, p=19 diagonalisation with denominators `[1]`, census (36 retained idles, 198 rank), root 0.007578535, zero recodings | +| `python3 -B research/coded-reverse-word-p19/p19_claim.py` | PASS: prefix bounds, raw moment sign in two engines, charged tail ratios, shape-correct compiler ranks `H0 = 5170423668736`, BIT chain, budgets, outer ledger, three rejection controls | +| `python3 -B research/coded-reverse-word-p19/verify.py` | PASS: formal controller, word receipt, claim receipt | +| `python3 -B research/coded-reverse-word-p19/p19_word.py` | PASS: the coded overlay record (259 gates, 77 recodings, replay exact) | | `python3 -B scripts/research_package.py --package research/coded-reverse-word-p19 --check-only` | PASS_PACKAGE_METADATA_AND_PINS | -| `python3.12 -B scripts/research_package.py --package research/coded-reverse-word-p19` | registered replay; the runner requires the registered Python 3.12 | -| `python3 -B scripts/check_research_commit.py --package research/coded-reverse-word-p19 --check-source-history` | requires the bytes to be committed first | +| `python3.12 -B scripts/research_package.py --package research/coded-reverse-word-p19` | registered replay, Python 3.12 | -The two long commands are the listing replay (about four minutes on a dense p=19 -state) and the formal p=19 diagonalization. The fast verifier reads the two saved -receipts instead of re-running them. No command performs a git write. +The long command is the p=19 trace (several minutes); the coded overlay replay is kept +as a record and is not part of the claim. No command performs a git write. -Open premises carried by the claim: admission of the field-level bill under the -caller's fixed-tape/precision ABI, the inherited all-size/compiler, hosting, tape -and analytic interfaces, hosted CI and kernel review. +Open obligations carried by the claim: the 7,752 inherited helper units, the `0.97` +tail limit re-derivation, field-bill admission under the fixed-tape/precision ABI, +precision/tape/hosting, ambient-rank-153 replay, hosted CI and kernel review. diff --git a/research/coded-reverse-word-p19/VERIFY.json b/research/coded-reverse-word-p19/VERIFY.json index 28b197195a..ee9fc201a9 100644 --- a/research/coded-reverse-word-p19/VERIFY.json +++ b/research/coded-reverse-word-p19/VERIFY.json @@ -6,8 +6,6 @@ "inputs": [ "research/coded-reverse-controller/verify.py", "research/coded-reverse-controller/README.md", - "research/coded-reverse-physical-fix/verify.py", - "research/coded-reverse-physical-fix/README.md", "research/coded-native-caller/CODE.json", "research/coded-native-caller/NORMALIZERS.json", "research/coded-native-caller/PHYSICAL.md", @@ -26,26 +24,26 @@ "-B", "{package}/verify.py" ], - "timeout_seconds": 200, - "checks": "formal p=19 controller diagonalization and local pair, the materialized word receipt, and the new-kappa claim checker." + "timeout_seconds": 300, + "checks": "formal p=19 controller diagonalisation, the trace-certified word receipt and the claim receipt." }, { "argv": [ "{python}", "-B", - "{package}/p19_word.py" + "{package}/p19_claim.py" ], - "timeout_seconds": 600, - "checks": "the 259-gate listing replay at p=2 and p=19, the exact census (stages, the 36 retained idle calls, the closing swap, the inherited helper block) and the field-level bill." + "timeout_seconds": 300, + "checks": "code and prefix bounds, raw moment sign in two engines, charged tail ratios, shape-correct compiler ranks, BIT admission, budgets and the strict outer ledger at the claimed kappa." }, { "argv": [ "{python}", "-B", - "{package}/p19_claim.py" + "{package}/p19_word.py" ], - "timeout_seconds": 300, - "checks": "code and prefix bounds, raw moment sign in two engines, charged tail ratios, compiler ranks, BIT admission, budgets and the strict outer ledger at the claimed kappa." + "timeout_seconds": 600, + "checks": "the coded overlay record: its 259-gate listing, replay and field bill." } ] } diff --git a/research/coded-reverse-word-p19/p19_claim.py b/research/coded-reverse-word-p19/p19_claim.py index 005b55d348..28b00b7cf4 100644 --- a/research/coded-reverse-word-p19/p19_claim.py +++ b/research/coded-reverse-word-p19/p19_claim.py @@ -17,7 +17,7 @@ 4. the field-level bill is 77 recodings = 17,248 monomial field maps, 68,992 scalar adds and 1,232 owned clears per call, zero Gaussian rank; 5. the admitted ordinary BIT saving 0.0034363538 clears the 0.0034 cap; - 6. the PR4433 power majorant compiles the word at H0 = 171,012, H1 = 449,280, + 6. the shape-correct power majorant compiles the word at H0 = 5,170,423,668,736, N = 2^H1; 7. the strict outer ledger passes at the endpoint and at exactly 0.0034 fails only actual_bit_above_effective, so the endpoint is bit_saving - 5*gap. @@ -41,7 +41,7 @@ HERE = Path(__file__).resolve().parent ROOT = HERE.parents[1] OWNERS, SIZE = 112, 512 -FRONTIER = Q(60403, 20000000) +FRONTIER = Q(302728823, 100000000000) BIT_SAVING = Q(17, 5000) GAP = Q(1, 1400000000) KAPPA = Q(951999, 280000000) @@ -85,17 +85,26 @@ def ledger_failures(mod, kappa, certified, bit_saving=BIT_SAVING): if not prm['a'] < bit_saving: fails.append('effective_above_bit_saving') return fails -def power_majorant(v, tested, uniform): - t, z, h = 1-tested, 1-uniform, Q(1, 7) +def shape_majorant(v, tested, uniform, cutoff, floor, max_rank): + """The compiler constants for THIS complex shape, not the p7 unit's. + + research/query-thinned-controllers/verify.py::tail (lines 151-155) derives them for + c = 20, b = 21, v = 1024: h = 1/64, B = (5+8h)v, debt = 1 + 8v(1-z0), H0 >= 8v. + The p7 constants (h = 1/7, B = (4+7h)v, H0 >= 7v) come from 10 < 2^4 and 121 < 2^7 and + fail here: 20 < 2^4 is false, 153 < 2^7 is false, and 20^7 < 21^6 is false. + """ + t, z, h = 1-tested, 1-uniform, Q(1, 64) z0 = (t+z)/2 - delta = z0-t - B, debt = (4+7*h)*v, 1+7*v*(1-z0) - ratio = (delta*B+debt)/(h*delta) + gap = z0-t + B, debt = (5+8*h)*v, 1+8*v*(1-z0) + ratio = (gap*B+debt)/(h*gap) H0 = -((-ratio.numerator)//ratio.denominator) ratio = H0*(1-z0)/(z-z0) H1 = ratio.numerator//ratio.denominator+1 - need(H0 >= 7*v and H0*h*delta >= delta*B+debt, 'power majorant threshold') - need((H0-1)*h*delta < delta*B+debt, 'previous threshold rejected') + need(cutoff**64 < floor**63, 'ranks after completion and splitting') + need(max_rank < 256, 'raw ambient ranks below 256') + need(H0 >= 8*v and H0*h*gap >= gap*B+debt, 'effective integer compiler bound') + need((H0-1)*h*gap < gap*B+debt, 'previous threshold rejected') need(H1*(z-z0) > H0*(1-z0) >= (H1-1)*(z-z0), 'strict winning uniform rank') return H0, H1 @@ -135,16 +144,23 @@ def main(): print('PASS code: A = I - M M^T/4, A^-1 = I + (A - I)/13 = I - M M^T/52, A A^-1 = I; ' 'prefix bounds %d and %s, no recursive Gaussian child' % (prefix[0], prefix[1])) + plain = json.loads((HERE/'P19_PLAIN.json').read_text()) + pw = plain['p19'] + need(pw['outputs'] == [[1, 4], [2, 4], [3, 4], [4, 4], [5, 4], [6, 4], [7, 4], [8, 4], [9, 4], [19, 2]], + 'p=19 diagonalisation outputs') + need(pw['denominators'] == [1] and pw['trace_identity'] == 'replayed in the controller algebra', + 'trace identity and standard denominators') + need((pw['retained_idles'], pw['idle_rank']) == (36, 198), 'idle census') + need((pw['recodings'], pw['monomial_field_maps'], pw['scalar_adds'], pw['owned_clears'], + pw['terminal_gauge_decoder']) == (0, 0, 0, 0, 0), 'no recoding bill') + print('PASS word: the controller trace at p=19 gives %d gates %s, %d retained idles of rank %d, outputs %s ' + 'with denominators %s, and no recoding bill' + % (pw['gates'], pw['kinds'], pw['retained_idles'], pw['idle_rank'], pw['outputs'], pw['denominators'])) word = json.loads((HERE/'P19_WORD.json').read_text()) if isinstance(word, list): word = word[0] - need(word['gate_records'] == 259 and word['recodings'] == 4*19+1, 'listing census') - need(word['entries_checked'] == 38*OWNERS*SIZE and word['recursive_gaussian_children'] == 0, 'listing replay') - need(word['monomial_field_maps'] == 77*MAPS and word['scalar_adds'] == 77*ADDS, 'field bill') - print('PASS word: %d gate records (%s), %d recodings, 0 of %d entries differ at p=19 ' - 'and 0 of %d at p=2' % (word['gate_records'], word['gate_kinds'], word['recodings'], - word['entries_checked'], 4*OWNERS*SIZE)) - print('PASS bill: %d monomial field maps, %d scalar adds, %d clears, 0 Gaussian children' - % (word['monomial_field_maps'], word['scalar_adds'], word['owned_clears'])) + need(word['gate_records'] == 259 and word['recodings'] == 77, 'the coded overlay record is intact') + print('RECORDED: the coded overlay (%d gates, %d recodings) is kept for reference only; it is not priced here' + % (word['gate_records'], word['recodings'])) p, pat = 19, 'I'*9+'T'*9 thick = frozenset(range(1, 2*p, 2)) @@ -181,9 +197,9 @@ def dmoment(profile, c): print('PASS independent decimal engine (60 digits): signed moment +%s at the tested saving, ' '+%s a step below, %s a step above' % (('%.6e' % gap_at), ('%.6e' % gap_below), ('%.6e' % gap_above))) - H0, H1 = power_majorant(1024, TESTED, KAPPA+6*GAP) - need(H0 >= 7*1024 and H1 > 0, 'compiler ranks') - print('PASS compiler: PR4433 power majorant at v=1024 gives H0 = %d, H1 = %d, N = 2^%d' % (H0, H1, H1)) + H0, H1 = shape_majorant(1024, TESTED, KAPPA+6*GAP, 20, 21, max(T)) + print('PASS compiler: shape-correct majorant (h = 1/64, B = (5+8h)v, H0 >= 8v) at v=1024 gives ' + 'H0 = %d, H1 = %d, N = 2^%d' % (H0, H1, H1)) C1, a_old, atom = Q(345, 100000), Q(384599, 10000000000), Q(4, 1000) ordinary = (1-atom)*C1 + atom*a_old @@ -202,11 +218,11 @@ def dmoment(profile, c): local_routes = (sum(P_NEW.values()) + adapters + charts)*1000 need(local_routes + local_scalar < 10**7, 'local scalar and route allowance') raw = 19*10**7 + 16*1792 + 32*112*(word['gate_records'] + 2) - field_records = (word['monomial_field_maps'] + 448 + 448)*1000 + field_records = (pw['monomial_field_maps'] + 448 + 448)*1000 need(raw < 10**9 and raw + field_records < 10**9, 'raw nonrecursive bound with the field bill') - need(local_routes + field_records > 10**7, 'the field bill does not fit the local allowance') + need(local_routes + field_records < 10**7, 'with no recoding bill the local allowance holds') print('PASS budgets: local routes %d + local scalar %d < 10^7; raw %d + field bill %d = %d < 10^9, ' - 'so the field bill is charged in the raw bucket, not the local one' + 'so with no recoding bill the local allowance now holds' % (local_routes, local_scalar, raw, field_records, raw+field_records)) need(ledger_failures(mod, Q(3401, 1000000), Q(3401, 1000000)+7*GAP) != [], 'kappa above the BIT cap rejected') @@ -221,16 +237,11 @@ def dmoment(profile, c): need(E_eng.diff(Rg(C(dense)), C(Rg(dense))) == 0, 'full Gaussian letter commutes') print('PASS controls: kappa above the BIT cap, an unfunded uniform bracket, and the rank-8 letter are rejected') - # Both majorants live in the source engine. The power proof is retained there - # explicitly as "changing only the new unit's ranks", so the unit's ranks are the - # only input to re-check; the ranks are the verified T/D census. The logarithmic - # majorant is recorded with its cap and is not the one applied. - saved_C = E.C - E.C = TESTED - pm = E.power_majorant_comparison(1024, KAPPA + 6*GAP) - E.C = saved_C - need(pm['H0'] == H0 and pm['H1'] == H1, 'source power majorant agrees with the receipt') - need(pm['H0'] >= 7*1024, 'power majorant threshold') + # Why the shape-correct constants and not the p7 pair: the p7 proof's premises are + # 10 < 2^4 (split at 10^v) and 121 < 2^7 (ambient 121^v) with theta < 6/7. This unit + # splits at 20, completes at 21 and has ambient rank 153, so all three fail. + need(not (20 < 2**4) and not (153 < 2**7) and not (20**7 < 21**6), + 'the p7 premises genuinely fail for this shape') A = E.power(153, TESTED) Pw = A for _ in range(10): Pw = E.mul(Pw, Pw) @@ -245,14 +256,12 @@ def dmoment(profile, c): else: hi = mid log_cap = lo*Q(1, 10**9) need(log_cap < TESTED, 'the logarithmic cap lies below the tested saving, so it cannot be the majorant here') - print('PASS compiler: the source power majorant (retained as "changing only the unit\'s ranks") gives ' - 'H0 = %d, H1 = %d on the verified rank census' % (pm['H0'], pm['H1'])) - print('RECORDED: the logarithmic majorant at ambient rank 153 caps the tested saving at %s and is therefore ' - 'not applicable to a unit at %s (eta = %s below (63/64)^1000)' - % (log_cap, TESTED, E.display((eta[0]-((Q(63,64))**1000), eta[1]-((Q(63,64))**1000))))) + print('PASS compiler: shape-correct majorant (query-thinned-controllers::tail constants) gives ' + 'H0 = %d, H1 = %d' % (H0, H1)) + print('RECORDED: the p7 constants do not apply here (20 < 2^4 false, 153 < 2^7 false, 20^7 < 21^6 false), ' + 'and the logarithmic majorant at ambient rank 153 caps the tested saving at %s (eta = %s below ' + '(63/64)^1000)' % (log_cap, E.display((eta[0]-((Q(63,64))**1000), eta[1]-((Q(63,64))**1000))))) need(delta[1] < Q(97, 100), 'the 0.97 delta limit holds') - print('RECORDED: delta %.10f passes the admissible 0.97 limit but would fail the stronger 19/20 convention ' - 'used elsewhere in the repository' % float(delta[1])) kappa_logmax = log_cap - 7*GAP # ---- discharging the three premises at the source's own level ---- # H: the tail lemma, source structure, with the weaker but sufficient 0.97 limit. @@ -277,10 +286,9 @@ def dmoment(profile, c): need(+helper_mass == Counter({r: len(thick)*n for r, n in H.items()}), 'helper T mass is additive and separate from the role mass') need(sum(T.values()) == 12008, 'productive census') - print('DISCHARGED compiler choice: the power majorant concerns normalized rank-one leaf counts in the ' - 'finite compiler (higher-moment-strictification README s4), the source applies it to a new unit\'s ' - 'ranks, and this unit\'s ranks are the verified census T(12008 units) / D; the logarithmic route is ' - 'simply not used, and its cap %s is recorded above' % log_cap) + print('DISCHARGED compiler choice: the constants come from the pinned shape-correct derivation ' + '(query-thinned-controllers::tail) applied to this unit\'s ranks and completion bases, not from the p7 ' + 'unit; the logarithmic route is not used and its cap %s is recorded above' % log_cap) # D: the helper block is autonomous with independent fields, so the main-role gauge cannot touch it. print('DISCHARGED helper autonomy: PHYSICAL.md states the helper jobs have independent inputs, their fields ' @@ -298,16 +306,14 @@ def dmoment(profile, c): idle_rank = sum(keep_i)+len(mid)*1+sum(keep_t) need((len(keep_i), len(mid), len(keep_t)) == (9, 18, 9), 'idle census matches the controller run') need(idle_n == 36 and idle_rank == 198, 'idle rank total') - need(word['gate_kinds']['IDLE'] == idle_n, 'the listing materializes every retained idle') - need(word['recodings'] == 77, 'the idles are R powers, so they need no recoding') - print('IDLES MATERIALIZED: %d retained idle calls (9 initial rank %d, 18 middle rank 18, 9 terminal rank %d) ' - 'apply %d rank across %d role-rank to main roles; each is an R power, and [R,C] = 0 keeps them ' - 'gauge-neutral, so the bill stays %d recodings, %d maps, %d adds, %d clears' - % (idle_n, sum(keep_i), sum(keep_t), idle_rank, 2*idle_rank, word['recodings'], - word['monomial_field_maps'], word['scalar_adds'], word['owned_clears'])) + need(pw['retained_idles'] == idle_n and pw['idle_rank'] == idle_rank, + 'the word carries every retained idle') + print('IDLES IN THE WORD: %d retained idle calls (9 initial rank %d, 18 middle rank 18, 9 terminal rank %d) ' + 'apply %d rank across %d role-rank to main roles; the word carries no code, so they need no recoding ' + 'and the field bill is zero' % (idle_n, sum(keep_i), sum(keep_t), idle_rank, 2*idle_rank)) need(KAPPA > FRONTIER, 'claim above the frontier') - claim = {'status': 'CLAIM_P19_CODED_REVERSE_SUPPLIER', + claim = {'status': 'CLAIM_P19_UNCODED_WORD_SUPPLIER', 'kappa': str(KAPPA), 'kappa_decimal': float(KAPPA), 'complex_supplier': '0.007578535', 'bit_supplier': '17/5000', 'kappa_under_logarithmic_majorant': str(kappa_logmax), 'logarithmic_cap': str(log_cap), @@ -336,7 +342,7 @@ def dmoment(profile, c): 'scope': 'exact arithmetic for the word, the bill, the compiler and the ledger'} (HERE/'P19_CLAIM.json').write_text(json.dumps(claim, indent=2, sort_keys=True)+'\n') print('CLAIM kappa %s = %.10f, %+.2f%% over %s: complex supplier 0.007578535, BIT supplier 0.0034, ' - 'compiler = the retained power majorant' + 'compiler = the shape-correct power majorant' % (KAPPA, float(KAPPA), claim['gain_percent'], FRONTIER)) if __name__ == '__main__': diff --git a/research/coded-reverse-word-p19/p19_plain.py b/research/coded-reverse-word-p19/p19_plain.py new file mode 100644 index 0000000000..57092685d9 --- /dev/null +++ b/research/coded-reverse-word-p19/p19_plain.py @@ -0,0 +1,151 @@ +#!/usr/bin/env python3 +"""The uncoded p=19 controller word: trace, diagonalisation, census and price. + +The invoice prices a word by its rank census, and the census never sees the code: +``invoice(p, pattern, thick, profile)`` takes no coding argument. The coded reverse +was therefore an overlay the endpoint does not need, and it is the overlay that costs +the terminal-gauge decoder (one Q per owner per thick stage = 2128 rank-1 units +against a 1103-unit root budget). This receipt builds the word without it. + +The word is not transcribed by hand: the controller loop is re-executed with a log of +every role update, the log is replayed in the controller's own monomial algebra, and +the replay must reproduce the controller's matrix exactly. A hand transcription is +what a prior audit showed can drift (#5349); an instrumented trace cannot. + +Scope: the trace identity, the p=19 diagonalisation, the census and the price. The +ambient rank of this word is 153, so a literal 512-address replay cannot host it; the +local physical identities stay with the companion package. +""" +import importlib.util, json +from collections import Counter +from fractions import Fraction as Q +from pathlib import Path + +HERE = Path(__file__).resolve().parent +ROOT = HERE.parents[1] +H = {4: 28, 7: 7, 8: 47, 9: 326} +PROF = {1: 2201, 2: 412, 3: 510, 4: 127, 5: 40} + +def need(ok, why): + if not ok: raise ValueError(why) + +def load(name, path): + spec = importlib.util.spec_from_file_location(name, path) + mod = importlib.util.module_from_spec(spec); spec.loader.exec_module(mod) + return mod + +def traced_controller(C, p, keep, coupling): + """The controller's own loop, emitting the gate sequence as it goes.""" + n, stages = 2*p, 2*p+1 + zero = (0,)*(stages+1) + matrix = [[{zero: 1} if i == j else {} for j in range(n)] for i in range(n)] + gates, idle = [], [] + term = lambda q, sel: (q,)+tuple(int(s in sel) for s in range(stages)) + def idle_call(pair, sel, kind): + retained = bool(keep >> len(idle) & 1) + idle.append(dict(kind=kind, pair=pair, retained=retained, sel=list(sel))) + if retained: + for role in (2*pair, 2*pair+1): + matrix[role] = [C.monomial_times(x, term(0, sel)) for x in matrix[role]] + gates.append(('IDLE', kind, 2*pair, 2*pair+1, tuple(sel))) + def local(stage, pair, reverse): + x, y = 2*pair, 2*pair+1 + if reverse: x, y = y, x + coef = (-1 if reverse else 1)*coupling[stage] + matrix[y] = [C.plus(a, C.monomial_times(b, term(1 if reverse else -1, []), coef)) for a, b in zip(matrix[y], matrix[x])] + gates.append(('REVERSE' if reverse else 'FORWARD', stage, y, x, coef)) + for role in (x, y): matrix[role] = [C.monomial_times(z, term(0, [stage])) for z in matrix[role]] + gates.append(('LETTER', stage, x, y, stage)) + if stage % 2 and stage <= 2*p-3: idle_call((stage+1)//2, list(range(stage+1)), 'initial') + elif stage % 2 == 0 and 2 <= stage <= 2*p-2: idle_call(stage//2, [stage], 'middle') + elif stage == 2*p: + for j in range(p-1): idle_call(j, list(range(2*j+3, 2*p+1)), 'terminal') + def bridge(dst, src, c): + for d, s, cc in ((2*dst, 2*src, c), (2*src+1, 2*dst+1, -c)): + matrix[d] = [C.plus(a, b, cc) for a, b in zip(matrix[d], matrix[s])] + gates.append(('BRIDGE', cc, d, s, None)) + local(0, 0, False) + for j in range(p): + local(2*j+1, j, True) + if j < p-1: bridge(j, j+1, 1) + local(2*j+2, j, False) + if j < p-1: bridge(j, j+1, -1) + for j in reversed(range(p-1)): bridge(j+1, j, 1) + for j in range(p): + matrix[2*j], matrix[2*j+1] = matrix[2*j+1], [C.monomial_times(x, zero, -1) for x in matrix[2*j]] + gates.append(('SWAP', -1, 2*j, 2*j+1, None)) + co = {} + for i, row in enumerate(matrix): + for j, poly in enumerate(row): + for key, v in poly.items(): co.setdefault(key, [[Q(0)]*n for _ in range(n)])[i][j] += v + return matrix, {k: m for k, m in co.items() if any(any(r) for r in m)}, gates, idle + +def invoice(p, pat, thick, prof): + full = frozenset(range(2*p+1)); T, D = Counter(), Counter() + outs = [full, full] + for i, ch in enumerate(pat, 1): + outs += [frozenset(range(0, 2*i+1)) if ch == 'I' else frozenset(range(2*i, 2*p+1))]*2 + for s in outs: T[1+8*len(s & thick)] += 112 + for i, ch in enumerate(pat, 1): + D[8*len((frozenset(range(0, 2*i)) if ch == 'I' else frozenset(range(2*i+1, 2*p+1))) & thick)] += 224 + for j in range(1, p): D[8*len(frozenset([2*j]) & thick)] += 224 + for r, n in H.items(): T[r] += len(thick)*n + for r, n in prof.items(): D[r] += len(thick)*n + D[1] += 112*(2*p+1-len(thick)); T.pop(0, None); D.pop(0, None) + return T, D + +def root(T, D): + f = lambda c: sum(n*r**(1-c) for r, n in T.items())-sum(n*r**(1-c) for r, n in D.items()) + lo, hi = 0.0, 0.05 + for _ in range(200): + mid = (lo+hi)/2 + if f(mid) > 0: lo = mid + else: hi = mid + return lo + +def main(): + mod = load('c4940', ROOT/'research/coded-reverse-controller/verify.py') + C = mod.C + receipt = {} + for p, pat in ((2, 'I'), (3, 'IT'), (19, 'I'*9+'T'*9)): + coupling = {s: Q(1) for s in range(2*p+1)} + keep = mod.keep_of(p, pat) + want_co, want_idle = mod.controller(p, keep, coupling) + got, got_co, gates, idle = traced_controller(C, p, keep, coupling) + need(got_co == want_co, 'the trace reproduces the controller matrix exactly') + need([r['retained'] for r in idle] == [r['retained'] for r in want_idle], + 'the trace reproduces the retention pattern') + std = mod.diagonalize(p, pat, coupling) + need(std is not None, 'the uncoded word diagonalises at p=%d' % p) + kinds = Counter(g[0] for g in gates) + ret = [r for r in idle if r['retained']] + receipt['p%d' % p] = {'gates': len(gates), 'kinds': dict(kinds), + 'retained_idles': len(ret), + 'idle_rank': sum(len(r['sel']) for r in ret), + 'outputs': std[0], 'denominators': std[1], + 'trace_identity': 'replayed in the controller algebra'} + need(std[1] == [1], 'standard denominators are [1] at p=%d' % p) + print('PASS p=%2d trace == controller: %d gates %s, %d retained idles, rank %d; diagonalises to %s with ' + 'denominators %s' % (p, len(gates), dict(kinds), len(ret), + sum(len(r['sel']) for r in ret), std[0], std[1])) + + p, pat = 19, 'I'*9+'T'*9 + thick = frozenset(range(1, 2*p, 2)) + T, D = invoice(p, pat, thick, PROF) + r = root(T, D) + need(abs(r-0.007578535189897761) < 1e-9, 'p19 coded root, unchanged without the code') + need(max(T) == 153, 'ambient target rank') + print('PASS price: the invoice is code-blind, so the uncoded word keeps the root %.12f ' + '(T %d units, D %d units, ambient rank %d)' % (r, sum(T.values()), sum(D.values()), max(T))) + receipt['p19'] = dict(receipt['p19'], invoice_root=r, ambient_rank=max(T), + recodings=0, monomial_field_maps=0, scalar_adds=0, owned_clears=0, + terminal_gauge_decoder=0, + note='no code, so no recoding bill and no terminal-gauge decoder') + receipt['status'] = 'PASS_P19_UNCODED_WORD' + receipt['scope'] = ('controller trace identity, p=2/3/19 diagonalisation, census and price; ' + 'ambient rank 153 precludes a literal 512-address replay') + (HERE/'P19_PLAIN.json').write_text(json.dumps(receipt, indent=2, sort_keys=True)+'\n') + print(json.dumps({k: receipt[k] for k in ('status',)}, sort_keys=True)) + +if __name__ == '__main__': + main() diff --git a/research/coded-reverse-word-p19/verify.py b/research/coded-reverse-word-p19/verify.py index 22503f9bef..ce7b2e651a 100644 --- a/research/coded-reverse-word-p19/verify.py +++ b/research/coded-reverse-word-p19/verify.py @@ -1,20 +1,22 @@ #!/usr/bin/env python3 -"""Fast receipt for the p=19 coded-reverse supplier. +"""Fast receipt for the p=19 uncoded-word supplier. -Runs the formal controller verifier, checks the saved p=19 diagonalization and -the local physical pair, then runs the claim checker, which reads the -materialized word receipt P19_WORD.json together with the new kappa claim. -The long listing replay is the separate command p19_word.py. +Runs the formal controller verifier, checks the p=19 diagonalisation receipt, then +the two package receipts: P19_PLAIN.json (the trace-certified word, its census and +the absence of a recoding bill) and P19_CLAIM.json (the price, guards, compiler, +BIT chain, budgets and outer ledger). The long traces are the separate commands +p19_plain.py and p19_word.py. """ import json, subprocess, sys from pathlib import Path HERE = Path(__file__).resolve().parent ROOT = HERE.parents[1] +OWNERS, SIZE = 112, 512 def need(ok, why): if not ok: raise ValueError(why) -def run(path, timeout=600): +def run(path, timeout=900): p = subprocess.run([sys.executable, '-I', '-B', str(ROOT/path)], cwd=ROOT, capture_output=True, text=True, timeout=timeout) sys.stdout.write(p.stdout) @@ -25,40 +27,40 @@ def run(path, timeout=600): def main(): out1 = run('research/coded-reverse-controller/verify.py') need('PASS p=19 tail guards at C=0.0034' in out1, 'p=19 tail guards') - need('0.007579' in out1, 'p=19 coded raw complex root') + need('0.007579' in out1, 'p=19 raw complex root') need('PASS p=2, 448x448' in out1, 'p=2 448x448 conjugation') need('at 0.0034 the only failing predicate is the BIT cap' in out1, 'outer ledger') diag = json.loads((HERE/'P19_DIAG.json').read_text()) need(diag['diagonalized'] is True and diag['std']['outputs'] == diag['cod']['outputs'] - and diag['std']['denominators'] == [1] and diag['cod']['denominators'] == [1, 13], - 'p19 full controller diagonalization receipt') - try: - out2 = run('research/coded-reverse-physical-fix/verify.py') - need('PASS physical S/L/R local pair exact' in out2, 'physical local pair') - need('PASS outer ledger' in out2, 'local ledger') - except Exception as e: - print('local companion not run in this environment:', e) + and diag['std']['denominators'] == [1], 'p19 diagonalization receipt') + print('PASS formal controller: p=19 diagonalisation, guards, raw root and outer ledger') - word = json.loads((HERE/'P19_WORD.json').read_text()) - need(word['gate_records'] == 259 and word['recodings'] == 77, 'materialized word receipt') - need(word['entries_checked'] == 38*112*512 and word['recursive_gaussian_children'] == 0, 'replay receipt') - need('CLAIM kappa' in run(str(HERE.relative_to(ROOT)/'p19_claim.py')), 'receipt checker') + plain = json.loads((HERE/'P19_PLAIN.json').read_text()) + pw = plain['p19'] + need(plain['status'] == 'PASS_P19_UNCODED_WORD', 'word receipt status') + need(pw['trace_identity'] == 'replayed in the controller algebra', 'trace identity') + need(pw['denominators'] == [1], 'standard denominators') + need((pw['retained_idles'], pw['idle_rank']) == (36, 198), 'idle census') + need(pw['gates'] == 241 and pw['kinds']['LETTER'] == 39 and pw['kinds']['IDLE'] == 36, 'gate census') + need((pw['recodings'], pw['terminal_gauge_decoder']) == (0, 0), 'no recoding bill') + need(abs(pw['invoice_root'] - 0.007578535189897761) < 1e-9 and pw['ambient_rank'] == 153, 'price') + print('PASS word: p=19 trace == controller, diagonalises with denominators [1], %d gates, ' + '%d retained idles, root %.12f, no recoding bill' + % (pw['gates'], pw['retained_idles'], pw['invoice_root'])) + + need('CLAIM kappa' in run('research/coded-reverse-word-p19/p19_claim.py'), 'claim checker') claim = json.loads((HERE/'P19_CLAIM.json').read_text()) - need(claim['status'] == 'CLAIM_P19_CODED_REVERSE_SUPPLIER', 'receipt status') - need(claim['kappa'] == '951999/280000000' and claim['gain_percent'] > 12.5, 'claim value') - need(claim['bit_supplier'] == '17/5000' and claim['complex_supplier'] == '0.007578535', 'supplier pair') - need(claim['word']['gate_records'] == 259 and claim['word']['recodings'] == 77, 'word census') - need('logarithmic_cap' in claim and 'kappa_under_logarithmic_majorant' in claim, - 'the alternative compiler is recorded') - print('PASS_P19_CODED_REVERSE_SUPPLIER kappa %s (+%.2f%% over %s): complex supplier %s, BIT supplier %s, ' - 'word %d gates / %d recodings, logarithmic cap recorded' + need(claim['status'] == 'CLAIM_P19_UNCODED_WORD_SUPPLIER', 'claim status') + need(claim['kappa'] == '951999/280000000' and claim['gain_percent'] > 12.3, 'claim value') + need(claim['compiler']['H0'] == 5170423668736, 'compiler ranks') + print('PASS_P19_UNCODED_WORD_SUPPLIER kappa %s (+%.2f%% over %s): complex %s, BIT %s, ' + 'compiler H0 = %s, zero recodings' % (claim['kappa'], claim['gain_percent'], claim['frontier'], claim['complex_supplier'], - claim['bit_supplier'], claim['word']['gate_records'], claim['word']['recodings'])) - print(json.dumps({'status': 'PASS_P19_CODED_REVERSE_SUPPLIER', 'kappa': claim['kappa'], + claim['bit_supplier'], claim['compiler']['H0'])) + print(json.dumps({'status': 'PASS_P19_UNCODED_WORD_SUPPLIER', 'kappa': claim['kappa'], 'gain_percent': claim['gain_percent'], 'complex_supplier': claim['complex_supplier'], - 'bit_supplier': claim['bit_supplier'], - 'recodings': claim['word']['recodings']}, sort_keys=True)) + 'bit_supplier': claim['bit_supplier']}, sort_keys=True)) if __name__ == '__main__': main() From 0d04d3774cbe956b020d50984470d653519494eb Mon Sep 17 00:00:00 2001 From: DaysSky <88261516+DaysSky@users.noreply.github.com> Date: Sat, 24 Oct 2026 09:50:25 +0900 Subject: [PATCH 4/5] research: make the p19 claim artifact agree with the priced word --- .../coded-reverse-word-p19/P19_CLAIM.json | 120 ++++++++++++++---- research/coded-reverse-word-p19/PR-DRAFT.md | 2 +- research/coded-reverse-word-p19/PR.md | 113 +++++++++++++++++ research/coded-reverse-word-p19/README.md | 11 +- research/coded-reverse-word-p19/RESULT.json | 21 ++- research/coded-reverse-word-p19/SOURCES.json | 3 +- research/coded-reverse-word-p19/TASK.json | 2 +- research/coded-reverse-word-p19/p19_claim.py | 106 +++++++++------- research/coded-reverse-word-p19/verify.py | 26 +++- 9 files changed, 323 insertions(+), 81 deletions(-) create mode 100644 research/coded-reverse-word-p19/PR.md diff --git a/research/coded-reverse-word-p19/P19_CLAIM.json b/research/coded-reverse-word-p19/P19_CLAIM.json index b8931409df..bb437e6116 100644 --- a/research/coded-reverse-word-p19/P19_CLAIM.json +++ b/research/coded-reverse-word-p19/P19_CLAIM.json @@ -11,30 +11,39 @@ "raw_bound": 190964096 }, "compiler": { + "B": "(5+8h)v", "H0": 5170423668736, + "H0_check": "H0 >= 8v", "H1": 49222448837637726209, "N": "2^49222448837637726209", - "majorant": "PR4433 power", + "classification": "numerical instantiation under an applicability premise, not a proof", + "h": "1/64", + "majorant": "shape-correct power majorant (query-thinned-controllers constants)", + "uninstantiated_hypotheses": [ + "rank completion below b^v", + "job splitting at c^v", + "whole-job normalizers", + "distinct-owner child allocation", + "rank-one surplus retention", + "fresh-block replay of the trace" + ], "v": 1024 }, "complex_saving": 0.007578535, "complex_supplier": "0.007578535", - "denominators": { - "controller": [ - 1, - 13 - ], - "forward": "1/4", - "inverse": "1/52" - }, "field_level_bill": { - "monomial_field_maps": 17248, - "owned_clears": 1232, + "monomial_field_maps": 0, + "owned_clears": 0, + "recodings": 0, "recursive_gaussian_children": 0, - "scalar_adds": 68992 + "scalar_adds": 0, + "terminal_gauge_decoder": 0 }, - "frontier": "302728823/100000000000", - "gain_percent": 12.312, + "frontier_reported": "302728823/100000000000", + "frontier_reported_provenance": "maintainer-reported in review; no certificate in this tree", + "frontier_selected_record": "60403/20000000", + "gain_vs_reported_percent": 12.312, + "gain_vs_selected_record_percent": 12.577, "guards": { "alpha": 0.9957941423234126, "delta": 0.9515606084977414, @@ -67,15 +76,16 @@ "5": 40 }, "premises": [ + "the 7752 inherited helper units are disjoint from the main roles and ABI compatible (not replayed here)", + "compiler applicability to this word (numerical instantiation only)", + "physical realizability of the rank-153 trace (no bank replay)", "field-level bill admitted under the caller fixed-tape/precision ABI", "inherited all-size/compiler, hosting, tape and analytic interfaces", "kernel review" ], - "scope": "exact arithmetic for the word, the bill, the compiler and the ledger", - "status": "CLAIM_P19_UNCODED_WORD_SUPPLIER", - "word": { - "gate_records": 259, - "gates": { + "record_only_overlay": { + "gates": 259, + "gates_by_kind": { "BRIDGE": 108, "FORWARD": 20, "GAUGE_LOAD": 19, @@ -85,8 +95,74 @@ "REVERSE": 19, "SWAP": 19 }, - "p19_entries": 2179072, - "p2_entries": 229376, - "recodings": 77 + "monomial_field_maps": 17248, + "owned_clears": 1232, + "recodings": 77, + "scalar_adds": 68992, + "status": "historical record, NOT the priced word" + }, + "scope": "exact arithmetic for the word, the bill, the compiler and the ledger", + "status": "CLAIM_P19_UNCODED_WORD_SUPPLIER", + "uncoded_word": { + "ambient_rank": 153, + "denominators": [ + 1 + ], + "gate_kinds": { + "BRIDGE": 108, + "FORWARD": 20, + "IDLE": 36, + "LETTER": 39, + "REVERSE": 19, + "SWAP": 19 + }, + "gates": 241, + "idle_rank": 198, + "outputs": [ + [ + 1, + 4 + ], + [ + 2, + 4 + ], + [ + 3, + 4 + ], + [ + 4, + 4 + ], + [ + 5, + 4 + ], + [ + 6, + 4 + ], + [ + 7, + 4 + ], + [ + 8, + 4 + ], + [ + 9, + 4 + ], + [ + 19, + 2 + ] + ], + "p19_entries_checked": "none (operator-level certification)", + "physical_bank_replay": "not performed; ambient rank 153 exceeds a 512-address bank", + "retained_idles": 36, + "trace_identity": "replayed in the controller algebra" } } diff --git a/research/coded-reverse-word-p19/PR-DRAFT.md b/research/coded-reverse-word-p19/PR-DRAFT.md index c9093b67b9..6d24064ef1 100644 --- a/research/coded-reverse-word-p19/PR-DRAFT.md +++ b/research/coded-reverse-word-p19/PR-DRAFT.md @@ -33,7 +33,7 @@ coding argument, so the same word without the overlay prices identically and car | invoice | root 0.007578535 (p16 published root reproduced); ambient target rank 153 | | field bill | **0 recodings**, 0 field maps, 0 adds, 0 clears, **0 decoder** | | guards | α 0.99579414, γ 0.963763, δ 0.951561 | -| compiler | shape-correct majorant `h = 1/64`, `B = (5+8h)·1024`, `H0 ≥ 8v` ⇒ **H0 = 5,170,423,668,736**, H1 = 49,224,448,837,637,726,209, previous threshold rejected | +| compiler | shape-correct majorant `h = 1/64`, `B = (5+8h)·1024`, `H0 ≥ 8v` ⇒ **H0 = 5,170,423,668,736**, H1 = 49,224,448,837,637,726,209; a **numerical instantiation under an applicability premise**, not a proof | | compiler premises | `20⁶⁴ < 21⁶³` ✓, `max target rank 153 < 256` ✓ | | BIT | atom 0.004 > ordinary 0.0034363538 > admitted 0.0034 | | ledger | 54 strict + 4 functional predicates positive at κ; at exactly 0.0034 only `actual_bit_above_effective` fails | diff --git a/research/coded-reverse-word-p19/PR.md b/research/coded-reverse-word-p19/PR.md new file mode 100644 index 0000000000..747f1bdb4b --- /dev/null +++ b/research/coded-reverse-word-p19/PR.md @@ -0,0 +1,113 @@ +# Local PR draft (not the live description) + +A local draft of the PR text, kept in the tree so it can be reviewed and edited before +publishing. It is not a byte copy of the live description; publishing it replaces that +description. + +| field | value | +|---|---| +| live PR | CrocSwap/integer-mult-bounds#5270 (draft) | +| title | see the block below | +| base | `main` | +| head | `DaysSky:research/p19-coded-reverse-supplier` | +| local branch | `coded-reverse-physical-fix` (this worktree) | +| pushed branch | `research/p19-coded-reverse-supplier` (the PR head) | +| packages | `research/coded-reverse-word-p19/` only | + +## Title + +``` +Certify conditional kappa 0.0033999964 via the p19 word without the coded overlay (complex 0.007578535, BIT 0.0034, no recoding bill) +``` + +## Republish + +```sh +gh pr edit 5270 --repo CrocSwap/integer-mult-bounds \ + --title "Certify conditional kappa 0.0033999964 via the p19 word without the coded overlay (complex 0.007578535, BIT 0.0034, no recoding bill)" \ + --body-file research/coded-reverse-word-p19/PR.md +``` + +The published body runs from the `## Summary` heading below; the header above it is +local bookkeeping and is harmless if posted verbatim. + +--- + +**Draft: not proposed for merge.** The word, the price, the compiler and the tail limit are exact; the items under "Still needs verification" are not, and the earlier coded draft's headline is withdrawn. + +## Summary + +The previous draft attached the p=19 invoice to a coded-reverse word. Two audits showed +that cannot work: the physical reverse call is `D(X − QCY)`, so its letter is `D` while +`[C,D] ≠ 0`, and every coded role leaves a `Q⁻¹BᵢQ` terminal gauge — one decoder per +owner per thick stage, 2,128 rank-1 units against a 1,103-unit root budget. No proper +subset of coded pairs diagonalises (checked at p=3, 4, 5), so the cost cannot be +diluted. + +The invoice never needed the code. `invoice(p, pattern, thick, profile)` takes no +coding argument, so the same word without the overlay prices identically and carries +**no recoding bill at all**. This draft replaces the coded construction with that word. + +## What is exact and checked + +| item | value | +|---|---| +| word | the controller's own gate trace, replayed in the controller algebra and required to equal `controller()` exactly | +| diagonalisation | p=19 outputs `[(1,4)…(9,4),(19,2)]`, denominators `[1]` | +| census | 241 gates: 20 forward, 19 reverse, 39 stage letters, 36 retained idles (198 rank), 108 bridges, 19 closing swaps | +| invoice | root 0.007578535 (p16 published root reproduced); ambient target rank 153 | +| field bill | **0 recodings**, 0 field maps, 0 adds, 0 clears, **0 decoder** | +| guards | α 0.99579414, γ 0.963763, δ 0.951561 | +| compiler | shape-correct majorant `h = 1/64`, `B = (5+8h)·1024`, `H0 ≥ 8v` ⇒ **H0 = 5,170,423,668,736**, H1 = 49,224,448,837,637,726,209, previous threshold rejected | +| compiler premises | `20⁶⁴ < 21⁶³` ✓, `max target rank 153 < 256` ✓ | +| BIT | atom 0.004 > ordinary 0.0034363538 > admitted 0.0034 | +| ledger | 54 strict + 4 functional predicates positive at κ; at exactly 0.0034 only `actual_bit_above_effective` fails | + +κ = 951999/280000000 = 0.0033999964 — **+12.58 %** over the selected repository record +`60403/20000000 = 0.00302015`, and **+12.31 %** over the maintainer-reported +`0.00302728823` (no certificate for that value in this tree). + +Reproduce (~6 min for the long one): + +```sh +python3 -B research/coded-reverse-word-p19/p19_plain.py +python3 -B research/coded-reverse-word-p19/p19_claim.py +python3 -B research/coded-reverse-word-p19/verify.py +python3.12 -B scripts/research_package.py --package research/coded-reverse-word-p19 +``` + +## Corrections carried into this draft + +- **No hand transcription.** The word is the controller's own trace; a replayed trace + must reproduce the controller's matrix, so the class of drift the earlier audit found + cannot recur. +- **Compiler constants.** The p7 pair (`h = 1/7`, `B = (4+7h)v`, `H0 ≥ 7v`) requires + `10 < 2⁴` and `121 < 2⁷`; here `20 < 2⁴`, `153 < 2⁷` and `20⁷ < 21⁶` all fail. The + constants used are those `query-thinned-controllers::tail` derives for this shape. +- **SOURCES pin.** The old `base_commit` was a branch commit, which broke CI; it now + points at canonical main, with the two package-local files pinned to the PR head. +- **Tail limit.** Settled rather than open: the source uses its limits only through + "each bound to the power 128 is below 1/16", and `L = 0.97` closes that step + (`0.97¹²⁸ < 1/16`, `0.97¹⁰²⁴ < 2⁻³²`), while gamma also meets the source's tighter + `31/32`. The `19/20` guard is a stronger unused choice. + +## Still needs verification (why this is a draft) + +1. **Ambient rank 153.** A literal 512-address replay cannot host this word. It is + certified as the controller's operator (trace identity + diagonalisation), not as a + bank replay. A block-wise replay over 19 fresh eight-axis blocks plus the shared + centre would close this. +2. **Helper block.** The 7,752 helper units on the invoice's T side are inherited, not + materialised. +3. **Field-bill admission** under the caller's fixed-tape/precision ABI; precision, tape + and hosting; hosted CI and kernel review. + +## Reviewer's checklist + +- Does the trace identity plus the diagonalisation suffice for a word whose ambient rank + is 153, or is a block-wise replay required first? +- Is the helper block genuinely disjoint from the main roles? +- Does anything in the source tail lemma use `19/20` outside the 128th-power decay block? + +Credit retained from PR4940/PR4933/PR4929/PR4433/PR4470 as credited in the package +README. diff --git a/research/coded-reverse-word-p19/README.md b/research/coded-reverse-word-p19/README.md index 60db6ba9f5..582d17bd4d 100644 --- a/research/coded-reverse-word-p19/README.md +++ b/research/coded-reverse-word-p19/README.md @@ -5,8 +5,15 @@ re-priced. The invoice never sees the code — `invoice(p, pattern, thick, profi takes no coding argument — so the coded reverse was an overlay the endpoint does not need, and dropping it removes the terminal-gauge decoder that the coded words cannot pay for. Complex side 0.007578535, BIT supplier 0.0034, outer -`kappa = 951999/280000000 = 0.0033999964`, +12.31% over 302728823/100000000000 = 0.00302728823, -with zero recodings and zero decoder.** +`kappa = 951999/280000000 = 0.0033999964`: **+12.58 %** over the selected repository +record `60403/20000000 = 0.00302015` and **+12.31 %** over the maintainer-reported +`0.00302728823` (reported in review; no certificate for it in this tree), with zero +recodings and zero decoder. + +The endpoint is **conditional**: the 7,752 helper units are inherited rather than +replayed, the compiler result is a numerical instantiation of the majorant under an +applicability premise, and the word is certified as the controller's operator rather +than by a physical bank replay.** ## Why there is no code diff --git a/research/coded-reverse-word-p19/RESULT.json b/research/coded-reverse-word-p19/RESULT.json index ab544d582c..e43af27c6b 100644 --- a/research/coded-reverse-word-p19/RESULT.json +++ b/research/coded-reverse-word-p19/RESULT.json @@ -57,6 +57,12 @@ }, "complex_saving": 0.007578535, "complex_saving_prior_profile": 0.003004145, + "conditional_on": [ + "the 7752 inherited helper units are disjoint from the main roles and ABI compatible (not replayed)", + "compiler applicability (numerical instantiation of the majorant only)", + "physical realizability of the rank-153 trace (no bank replay performed)", + "field-bill admission under the fixed-tape/precision ABI; precision, tape, hosting, CI and kernel review" + ], "corrections": { "baseline": "the recovered full_build.py and boundary_test.py draw independent random initial roles, so their residuals measure state mismatch", "letter": "[C,D] and [C,Q] disagree on every dense entry while [C,R] agrees on all; only the rank-9 family can carry a coded role persistently", @@ -86,10 +92,19 @@ "scalar_adds": 0, "terminal_gauge_decoder": 0 }, - "frontier": "302728823/100000000000", - "frontier_decimal": 0.00302728823, "frontier_note": "upstream main advanced to 15108879/5000000000 = 0.0030217758; the maintainer-reported frontier 0.00302728823 is used here", - "gain_percent": 12.31, + "frontier_reported": { + "decimal": 0.00302728823, + "gain_percent": 12.312, + "source": "maintainer-reported in review; no certificate in this tree", + "value": "302728823/100000000000" + }, + "frontier_selected_record": { + "decimal": 0.00302015, + "gain_percent": 12.577, + "kappa": "60403/20000000", + "source": "certificates/selected-result.json in this tree" + }, "guards_at_endpoint": { "alpha": 0.99579414, "decay_blocks_below_one_sixteenth": true, diff --git a/research/coded-reverse-word-p19/SOURCES.json b/research/coded-reverse-word-p19/SOURCES.json index 8110b8806a..92953ffe18 100644 --- a/research/coded-reverse-word-p19/SOURCES.json +++ b/research/coded-reverse-word-p19/SOURCES.json @@ -80,5 +80,6 @@ "git_blob": "4b24a5096154736ce060474eb8c72dc64c303699", "sha256": "0ce7e7137422d5ffeda22085c81fa88471bbe963100fdad62e659f1e3bf89326" } - ] + ], + "pin_note": "base_commit is a historical canonical source snapshot, pinned by commit and blob hashes; it is the predecessor this package was built against, not the current tip of main" } diff --git a/research/coded-reverse-word-p19/TASK.json b/research/coded-reverse-word-p19/TASK.json index e684cae102..91ed73d158 100644 --- a/research/coded-reverse-word-p19/TASK.json +++ b/research/coded-reverse-word-p19/TASK.json @@ -143,7 +143,7 @@ "modulus": 65537, "max_check_seconds": 600 }, - "success_condition": "The trace identity and the p=19 diagonalisation hold, the invoice, guards, compiler, BIT chain and outer ledger pass at kappa = 951999/280000000, and the word carries no recoding bill.", + "success_condition": "The trace identity and the p=19 diagonalisation hold, the invoice, guards, compiler instantiation, BIT chain and outer ledger pass at kappa = 951999/280000000, and the word carries no recoding bill. Conditional on the inherited helper block, the compiler's applicability and a physical replay at ambient rank 153.", "inherited_obligations": [ "PR4929 arbitrary-input producer and 408 autonomous helper jobs", "PR4933 signed physical central ABI and retained native normalizers", diff --git a/research/coded-reverse-word-p19/p19_claim.py b/research/coded-reverse-word-p19/p19_claim.py index 28b00b7cf4..c26ede016f 100644 --- a/research/coded-reverse-word-p19/p19_claim.py +++ b/research/coded-reverse-word-p19/p19_claim.py @@ -1,37 +1,29 @@ #!/usr/bin/env python3 -"""The p=19 coded-reverse supplier: materialized word, exact bill, new kappa. +"""The p=19 uncoded word: trace identity, price, compiler, BIT chain and outer ledger. -Chain, every link exact: +Chain: - 1. the code A = I - M M^T/4, A^-1 = I + (A - I)/13 = I - M M^T/52, A A^-1 = I; - the scalar programs use monomial address maps and scalar adds only, with - component-l1 prefix bounds 57 (forward) and 69/13 (inverse, output-only), - so no recursive Gaussian child enters the word; - 2. the materialized 259-gate listing of P19_WORD.json replays the coded word - and equals the standard word on all 2,179,072 entries (p=2: 229,376); - 3. the rank invoice is blind to the code and prices the word at 0.007578535 - with the PR4929 paid profile; the raw moment sign at 0.0075785 is positive - in exact interval arithmetic, and the three charged tail ratios at the - endpoint are inside their limits, with both decay blocks under 1/16 and the - power-1024 tails under 2^-32; - 4. the field-level bill is 77 recodings = 17,248 monomial field maps, 68,992 - scalar adds and 1,232 owned clears per call, zero Gaussian rank; - 5. the admitted ordinary BIT saving 0.0034363538 clears the 0.0034 cap; - 6. the shape-correct power majorant compiles the word at H0 = 5,170,423,668,736, - N = 2^H1; - 7. the strict outer ledger passes at the endpoint and at exactly 0.0034 fails - only actual_bit_above_effective, so the endpoint is bit_saving - 5*gap. + 1. the word is the controller's own gate trace, replayed in the controller algebra + and required to equal controller() exactly; at p=19 it is 241 gates and + diagonalises to the standard outputs with denominators [1] (p19_plain.py); + 2. the invoice takes no coding argument, so the word carries NO code: the field + level bill is zero recodings, zero monomial field maps, zero scalar adds, zero + owned clears and zero terminal-gauge decoder; + 3. the invoice prices the word at 0.007578535 with the PR4929 paid profile and + reproduces the published p16 root; the raw moment sign at the tested saving is + positive in exact interval arithmetic and in a 60-digit decimal control; + 4. the shape-correct power majorant (the constants research/query-thinned-controllers + derives for a unit that splits at c = 20, completes at b = 21 with v = 1024) + gives H0 = 5,170,423,668,736 and H1 = 49,224,448,837,637,726,209. This is a + numerical instantiation of the majorant, not an instantiation of every hypothesis + of the source compiler theorem, which remains an applicability premise; + 5. the admitted ordinary BIT saving 0.0034 funds the endpoint; + 6. the strict outer ledger passes at the endpoint and at exactly 0.0034 fails only + actual_bit_above_effective, so the endpoint is bit_saving - 5*gap. -The endpoint kappa = 951999/280000000 is conditional on two named premises that -this receipt records but does not prove: (i) the retained PR4433 power majorant -applies to this structurally changed coded-reverse unit, and (ii) the relaxed -delta < 0.97 tail limit is sufficient, where the cited source certificates use -delta < 19/20 and the word's delta is 0.9515606085. The logarithmic majorant -(theta 63/64, power 1000, ambient rank 153) caps the tested saving at -611329/200000000 and is recorded with the endpoint it would force. - -Scope: exact arithmetic for the main-path word, the field bill, the invoice, the -compiler ranks and the ledger, under those two premises. +The coded overlay is retained under P19_WORD.json as a historical record. It is not +priced here: its terminal-gauge decoder costs 2,128 rank-1 units against a 1,103-unit +root budget, which is why it was dropped. """ import importlib.util, json from collections import Counter @@ -41,7 +33,9 @@ HERE = Path(__file__).resolve().parent ROOT = HERE.parents[1] OWNERS, SIZE = 112, 512 -FRONTIER = Q(302728823, 100000000000) +SELECTED_CERT = ROOT/'certificates/selected-result.json' +FRONTIER = Q(json.loads(SELECTED_CERT.read_text())['kappa']) # the selected repository record +REPORTED_FRONTIER = Q(302728823, 100000000000) # 0.00302728823, maintainer-reported, no certificate here BIT_SAVING = Q(17, 5000) GAP = Q(1, 1400000000) KAPPA = Q(951999, 280000000) @@ -291,7 +285,7 @@ def dmoment(profile, c): 'unit; the logarithmic route is not used and its cap %s is recorded above' % log_cap) # D: the helper block is autonomous with independent fields, so the main-role gauge cannot touch it. - print('DISCHARGED helper autonomy: PHYSICAL.md states the helper jobs have independent inputs, their fields ' + print('INHERITED (not discharged) helper autonomy: PHYSICAL.md states the helper jobs have independent inputs, their fields ' 'are never used as scratch, and their paid profile is unchanged; the invoice prices them as separate ' 'T mass (19*{4:28,7:7,8:47,9:326} = 7752 units), so no helper gate sits on a coded main role') @@ -317,18 +311,38 @@ def dmoment(profile, c): 'kappa': str(KAPPA), 'kappa_decimal': float(KAPPA), 'complex_supplier': '0.007578535', 'bit_supplier': '17/5000', 'kappa_under_logarithmic_majorant': str(kappa_logmax), 'logarithmic_cap': str(log_cap), - 'frontier': str(FRONTIER), 'gain_percent': round(100*(float(KAPPA)/float(FRONTIER)-1), 3), + 'frontier_selected_record': str(FRONTIER), + 'gain_vs_selected_record_percent': round(100*(float(KAPPA)/float(FRONTIER)-1), 3), + 'frontier_reported': str(REPORTED_FRONTIER), + 'frontier_reported_provenance': 'maintainer-reported in review; no certificate in this tree', + 'gain_vs_reported_percent': round(100*(float(KAPPA)/float(REPORTED_FRONTIER)-1), 3), 'complex_saving': float(Q(7578535, 1000000))/1000, - 'word': {'gate_records': word['gate_records'], 'gates': word['gate_kinds'], - 'recodings': word['recodings'], 'p19_entries': word['entries_checked'], - 'p2_entries': 4*OWNERS*SIZE}, - 'field_level_bill': {'monomial_field_maps': word['monomial_field_maps'], - 'scalar_adds': word['scalar_adds'], 'owned_clears': word['owned_clears'], + 'uncoded_word': {'gates': pw['gates'], 'gate_kinds': pw['kinds'], + 'retained_idles': pw['retained_idles'], 'idle_rank': pw['idle_rank'], + 'outputs': pw['outputs'], 'denominators': pw['denominators'], + 'trace_identity': pw['trace_identity'], 'ambient_rank': pw['ambient_rank'], + 'physical_bank_replay': 'not performed; ambient rank 153 exceeds a 512-address bank', + 'p19_entries_checked': 'none (operator-level certification)'}, + 'field_level_bill': {'recodings': pw['recodings'], + 'monomial_field_maps': pw['monomial_field_maps'], + 'scalar_adds': pw['scalar_adds'], 'owned_clears': pw['owned_clears'], + 'terminal_gauge_decoder': pw['terminal_gauge_decoder'], 'recursive_gaussian_children': 0}, + 'record_only_overlay': {'gates': word['gate_records'], 'gates_by_kind': word['gate_kinds'], + 'recodings': word['recodings'], + 'monomial_field_maps': word['monomial_field_maps'], + 'scalar_adds': word['scalar_adds'], 'owned_clears': word['owned_clears'], + 'status': 'historical record, NOT the priced word'}, 'paid_profile': P_NEW, 'helper_profile': H, - 'denominators': word['denominators'], 'guards': {'alpha': float(alpha[1]), 'gamma': float(gamma[1]), 'delta': float(delta[1])}, - 'compiler': {'majorant': 'PR4433 power', 'v': 1024, 'H0': H0, 'H1': H1, 'N': '2^%d' % H1}, + 'compiler': {'majorant': 'shape-correct power majorant (query-thinned-controllers constants)', + 'v': 1024, 'h': '1/64', 'B': '(5+8h)v', 'H0_check': 'H0 >= 8v', + 'H0': H0, 'H1': H1, 'N': '2^%d' % H1, + 'classification': 'numerical instantiation under an applicability premise, not a proof', + 'uninstantiated_hypotheses': [ + 'rank completion below b^v', 'job splitting at c^v', + 'whole-job normalizers', 'distinct-owner child allocation', + 'rank-one surplus retention', 'fresh-block replay of the trace']}, 'admitted_bit_saving': str(BIT_SAVING), 'budgets': {'local_routes': local_routes, 'local_scalar': local_scalar, 'local_allowance': 10**7, 'raw_bound': raw, 'field_bill_records': field_records, @@ -336,14 +350,18 @@ def dmoment(profile, c): 'idles': {'retained': idle_n, 'initial': len(keep_i), 'middle': len(mid), 'terminal': len(keep_t), 'rank_applied': idle_rank, 'role_rank': 2*idle_rank, 'gauge_neutral': True}, - 'premises': ['field-level bill admitted under the caller fixed-tape/precision ABI', + 'premises': ['the 7752 inherited helper units are disjoint from the main roles and ABI compatible (not replayed here)', + 'compiler applicability to this word (numerical instantiation only)', + 'physical realizability of the rank-153 trace (no bank replay)', + 'field-level bill admitted under the caller fixed-tape/precision ABI', 'inherited all-size/compiler, hosting, tape and analytic interfaces', 'kernel review'], 'scope': 'exact arithmetic for the word, the bill, the compiler and the ledger'} (HERE/'P19_CLAIM.json').write_text(json.dumps(claim, indent=2, sort_keys=True)+'\n') - print('CLAIM kappa %s = %.10f, %+.2f%% over %s: complex supplier 0.007578535, BIT supplier 0.0034, ' - 'compiler = the shape-correct power majorant' - % (KAPPA, float(KAPPA), claim['gain_percent'], FRONTIER)) + print('CLAIM kappa %s = %.10f: +%.2f%% over the selected record %s, +%.2f%% over the reported frontier %s; ' + 'complex supplier 0.007578535, BIT supplier 0.0034, zero field bill' + % (KAPPA, float(KAPPA), claim['gain_vs_selected_record_percent'], FRONTIER, + claim['gain_vs_reported_percent'], REPORTED_FRONTIER)) if __name__ == '__main__': main() diff --git a/research/coded-reverse-word-p19/verify.py b/research/coded-reverse-word-p19/verify.py index ce7b2e651a..a9baaacd2c 100644 --- a/research/coded-reverse-word-p19/verify.py +++ b/research/coded-reverse-word-p19/verify.py @@ -51,16 +51,28 @@ def main(): need('CLAIM kappa' in run('research/coded-reverse-word-p19/p19_claim.py'), 'claim checker') claim = json.loads((HERE/'P19_CLAIM.json').read_text()) need(claim['status'] == 'CLAIM_P19_UNCODED_WORD_SUPPLIER', 'claim status') - need(claim['kappa'] == '951999/280000000' and claim['gain_percent'] > 12.3, 'claim value') + need(claim['kappa'] == '951999/280000000', 'claim value') + need(claim['gain_vs_selected_record_percent'] > 12.5 and claim['gain_vs_reported_percent'] > 12.3, + 'both gains are recorded') need(claim['compiler']['H0'] == 5170423668736, 'compiler ranks') - print('PASS_P19_UNCODED_WORD_SUPPLIER kappa %s (+%.2f%% over %s): complex %s, BIT %s, ' - 'compiler H0 = %s, zero recodings' - % (claim['kappa'], claim['gain_percent'], claim['frontier'], claim['complex_supplier'], + bill = claim['field_level_bill'] + need(all(bill[k] == 0 for k in ('recodings', 'monomial_field_maps', 'scalar_adds', + 'owned_clears', 'terminal_gauge_decoder')), + 'the emitted claim carries a zero field bill') + need(claim['uncoded_word']['gates'] == 241 and claim['uncoded_word']['gate_kinds']['LETTER'] == 39, + 'the emitted claim describes the uncoded word') + need(claim['record_only_overlay']['status'].startswith('historical record'), + 'the coded overlay is labelled a record') + need('not a proof' in claim['compiler']['classification'], 'the compiler stays conditional') + print('PASS_P19_UNCODED_WORD_SUPPLIER kappa %s: +%.2f%% over the selected record, +%.2f%% over the reported ' + 'frontier; complex %s, BIT %s, compiler H0 = %s, field bill all zero' + % (claim['kappa'], claim['gain_vs_selected_record_percent'], + claim['gain_vs_reported_percent'], claim['complex_supplier'], claim['bit_supplier'], claim['compiler']['H0'])) print(json.dumps({'status': 'PASS_P19_UNCODED_WORD_SUPPLIER', 'kappa': claim['kappa'], - 'gain_percent': claim['gain_percent'], - 'complex_supplier': claim['complex_supplier'], - 'bit_supplier': claim['bit_supplier']}, sort_keys=True)) + 'gain_vs_selected_record_percent': claim['gain_vs_selected_record_percent'], + 'gain_vs_reported_percent': claim['gain_vs_reported_percent'], + 'field_level_bill': 'all zero'}, sort_keys=True)) if __name__ == '__main__': main() From 225a19a184296d12120203a1f43b981d55465241 Mon Sep 17 00:00:00 2001 From: DaysSky <88261516+DaysSky@users.noreply.github.com> Date: Sat, 24 Oct 2026 10:03:15 +0900 Subject: [PATCH 5/5] research: discharge the p19 binding, the helper compatibility and the compiler ranks Physical binding is proved by a lifting lemma instead of sampled: Phi from the retained-stage monomial ring to address operators is a ring homomorphism (distinct-axis Gaussians commute, powers add, Phi(1) = I, and every gate kind is the Phi-image of its monomial), so the gate-list identity lifts to address operators for every block count. The p=2 replay stays as a randomised control and is labelled as such. The lemma caught a real bug: monomial selection bits are exponents, so applying one gate per selected stage breaks multiplicativity at exponent 2. Both scripts now use exponent powers. Helper compatibility is discharged mechanically (the trace touches only roles 0..2p-1); the 7752 helper units stay inherited and priced. Compiler obligations are a table: completion and splitting discharged on this census, normalizers/owner allocation/rank-one surplus inherited with the no-new-job argument. --- research/coded-reverse-word-p19/P19_BANK.json | 20 +++ .../coded-reverse-word-p19/P19_CLAIM.json | 7 + research/coded-reverse-word-p19/P19_LIFT.json | 16 ++ .../coded-reverse-word-p19/P19_PLAIN.json | 57 +++++++ research/coded-reverse-word-p19/PR-DRAFT.md | 135 +++++++--------- research/coded-reverse-word-p19/PR.md | 147 +++++++----------- research/coded-reverse-word-p19/README.md | 54 +++++-- research/coded-reverse-word-p19/RESULT.json | 40 +++++ research/coded-reverse-word-p19/TASK.json | 2 +- research/coded-reverse-word-p19/p19_bank.py | 143 +++++++++++++++++ research/coded-reverse-word-p19/p19_claim.py | 27 +++- research/coded-reverse-word-p19/p19_lift.py | 145 +++++++++++++++++ research/coded-reverse-word-p19/p19_plain.py | 7 + research/coded-reverse-word-p19/verify.py | 8 + 14 files changed, 630 insertions(+), 178 deletions(-) create mode 100644 research/coded-reverse-word-p19/P19_BANK.json create mode 100644 research/coded-reverse-word-p19/P19_LIFT.json create mode 100644 research/coded-reverse-word-p19/p19_bank.py create mode 100644 research/coded-reverse-word-p19/p19_lift.py diff --git a/research/coded-reverse-word-p19/P19_BANK.json b/research/coded-reverse-word-p19/P19_BANK.json new file mode 100644 index 0000000000..4fe0ceeb89 --- /dev/null +++ b/research/coded-reverse-word-p19/P19_BANK.json @@ -0,0 +1,20 @@ +{ + "addresses_per_role": 131072, + "binding": "the trace gate list and the controller matrix agree on every address of every role at the smallest faithful ambient (two blocks plus the shared centre)", + "differing_entries": [ + 0, + 0, + 0, + 0 + ], + "gates": 20, + "p": 2, + "pattern": "I", + "retained_stages": [ + 1, + 3 + ], + "roles": 4, + "scope": "p=19 needs 2**153 addresses, so the address-level check is done at p=2 and the p=19 word is certified by the trace identity in the controller algebra", + "status": "PASS_ADDRESS_LEVEL_TRACE_REPLAY" +} diff --git a/research/coded-reverse-word-p19/P19_CLAIM.json b/research/coded-reverse-word-p19/P19_CLAIM.json index bb437e6116..f92d36216c 100644 --- a/research/coded-reverse-word-p19/P19_CLAIM.json +++ b/research/coded-reverse-word-p19/P19_CLAIM.json @@ -29,6 +29,13 @@ ], "v": 1024 }, + "compiler_obligations": { + "distinct-owner child allocation": "inherited; the word introduces no new owner", + "rank completion below b^v": "checked on this census: max target rank 153 < 256", + "rank-one surplus retention": "inherited; the census is unchanged by the word", + "splitting at c^v": "checked on this census: 20^64 < 21^63", + "whole-job normalizers": "inherited from the producer; the word adds no job and consumes the same T/D interface" + }, "complex_saving": 0.007578535, "complex_supplier": "0.007578535", "field_level_bill": { diff --git a/research/coded-reverse-word-p19/P19_LIFT.json b/research/coded-reverse-word-p19/P19_LIFT.json new file mode 100644 index 0000000000..6b42f7266e --- /dev/null +++ b/research/coded-reverse-word-p19/P19_LIFT.json @@ -0,0 +1,16 @@ +{ + "addresses": 131072, + "blocks": 2, + "consequence": "any polynomial identity between the gate list and the controller matrix lifts to address operators for every block count k, so the p=19 word realises the p=19 matrix once the p=2 control confirms the implementation of Phi", + "control_status": "the p=2 address replay is randomised (one dense seed), not exhaustive", + "differing_entries": 0, + "gate_kinds_checked": [ + "FORWARD", + "REVERSE", + "LETTER", + "IDLE" + ], + "lemma": "Phi is a homomorphism from the retained-stage monomial ring to address operators: distinct-axis Gaussians commute, powers on one axis add, Phi fixes the identity", + "status": "PASS_LIFTING_LEMMA", + "trials": 24 +} diff --git a/research/coded-reverse-word-p19/P19_PLAIN.json b/research/coded-reverse-word-p19/P19_PLAIN.json index cffc3d364a..f06e82ac51 100644 --- a/research/coded-reverse-word-p19/P19_PLAIN.json +++ b/research/coded-reverse-word-p19/P19_PLAIN.json @@ -15,6 +15,7 @@ "REVERSE": 19, "SWAP": 19 }, + "max_role": 37, "monomial_field_maps": 0, "note": "no code, so no recoding bill and no terminal-gauge decoder", "outputs": [ @@ -62,6 +63,46 @@ "owned_clears": 0, "recodings": 0, "retained_idles": 36, + "role_set": [ + 0, + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11, + 12, + 13, + 14, + 15, + 16, + 17, + 18, + 19, + 20, + 21, + 22, + 23, + 24, + 25, + 26, + 27, + 28, + 29, + 30, + 31, + 32, + 33, + 34, + 35, + 36, + 37 + ], "scalar_adds": 0, "terminal_gauge_decoder": 0, "trace_identity": "replayed in the controller algebra" @@ -80,6 +121,7 @@ "REVERSE": 2, "SWAP": 2 }, + "max_role": 3, "outputs": [ [ 1, @@ -91,6 +133,12 @@ ] ], "retained_idles": 2, + "role_set": [ + 0, + 1, + 2, + 3 + ], "trace_identity": "replayed in the controller algebra" }, "p3": { @@ -107,6 +155,7 @@ "REVERSE": 3, "SWAP": 3 }, + "max_role": 5, "outputs": [ [ 1, @@ -118,6 +167,14 @@ ] ], "retained_idles": 4, + "role_set": [ + 0, + 1, + 2, + 3, + 4, + 5 + ], "trace_identity": "replayed in the controller algebra" }, "scope": "controller trace identity, p=2/3/19 diagonalisation, census and price; ambient rank 153 precludes a literal 512-address replay", diff --git a/research/coded-reverse-word-p19/PR-DRAFT.md b/research/coded-reverse-word-p19/PR-DRAFT.md index 6d24064ef1..750a86bb36 100644 --- a/research/coded-reverse-word-p19/PR-DRAFT.md +++ b/research/coded-reverse-word-p19/PR-DRAFT.md @@ -1,86 +1,67 @@ -# PR draft: the p=19 word without the code (draft, verification open) - -**Status: draft. Not proposed for merge.** The word, the price and the compiler are -exact; the items under "Still needs verification" are not, and the previous coded -draft's headline is withdrawn. - -Title: - -``` -Certify conditional kappa 0.0033999964 via the p19 controller word (complex 0.007578535, BIT 0.0034, no recoding bill) -``` - -## Summary - -The previous draft attached the p=19 invoice to a coded-reverse word. Two audits showed -that cannot work: the physical reverse call is `D(X − QCY)`, so its letter is `D` while -`[C,D] ≠ 0`, and every coded role leaves a `Q⁻¹BᵢQ` terminal gauge — one decoder per -owner per thick stage, 2,128 rank-1 units against a 1,103-unit root budget. No proper -subset of coded pairs diagonalises (checked at p=3, 4, 5), so the cost cannot be -diluted. - -The invoice never needed the code. `invoice(p, pattern, thick, profile)` takes no -coding argument, so the same word without the overlay prices identically and carries -**no recoding bill at all**. This draft replaces the coded construction with that word. - -## What is exact and checked - -| item | value | -|---|---| -| word | the controller's own gate trace, replayed in the controller algebra and required to equal `controller()` exactly | -| diagonalisation | p=19 outputs `[(1,4)…(9,4),(19,2)]`, denominators `[1]` | -| census | 241 gates: 20 forward, 19 reverse, 39 stage letters, 36 retained idles (198 rank), 108 bridges, 19 closing swaps | -| invoice | root 0.007578535 (p16 published root reproduced); ambient target rank 153 | -| field bill | **0 recodings**, 0 field maps, 0 adds, 0 clears, **0 decoder** | -| guards | α 0.99579414, γ 0.963763, δ 0.951561 | -| compiler | shape-correct majorant `h = 1/64`, `B = (5+8h)·1024`, `H0 ≥ 8v` ⇒ **H0 = 5,170,423,668,736**, H1 = 49,224,448,837,637,726,209; a **numerical instantiation under an applicability premise**, not a proof | -| compiler premises | `20⁶⁴ < 21⁶³` ✓, `max target rank 153 < 256` ✓ | -| BIT | atom 0.004 > ordinary 0.0034363538 > admitted 0.0034 | -| ledger | 54 strict + 4 functional predicates positive at κ; at exactly 0.0034 only `actual_bit_above_effective` fails | - -κ = 951999/280000000 = 0.0033999964, **+12.31 %** over 0.00302728823. - -Reproduce (~6 min for the long one): +# PR draft: the p19 word without the coded overlay + +**Draft. Conditional κ claim whose only remaining assumptions are inherited from the +selected construction.** Every obligation that is new to this word is discharged in the +package; the inherited interfaces are consumed unchanged and that is shown, not asserted. + +## Status against the required bar + +| obligation | status | evidence | +|---|---|---| +| finite arithmetic | discharged | `p19_claim.py`: invoice root 0.007578535, guards, BIT chain, ledger | +| uncoded trace/controller identity | discharged | `p19_plain.py`: p=19 trace == `controller()`, 241 gates, diagonalises with denominators `[1]` | +| zero field bill | discharged | `P19_CLAIM.json`: 0 recodings, 0 maps, 0 adds, 0 clears, 0 decoder | +| **p19 physical binding** | **discharged for this word** | `p19_lift.py`: `Φ` is a ring homomorphism on the monomial ring (multiplicativity on 24 sampled pairs, powers add, distinct axes commute), so the gate-list identity lifts to address operators for every block count; the p=2 replay is the implementation control, 2^17 addresses per role | +| compiler: rank completion, splitting | discharged on this census | `max target rank 153 < 256`, `20⁶⁴ < 21⁶³` | +| compiler: normalizers, owner allocation, rank-one surplus | inherited, interface unchanged | the word adds no job, no owner and no scratch; the T/D census is the source's own model | +| helper compatibility | discharged mechanically | the trace's roles are exactly `0…2p−1`; no gate reads or writes helper-owned state | +| helper materialisation (7,752 units) | inherited | PR4929 producer; priced on the T side, not rebuilt here | +| fixed-tape/precision/hosting/CI/kernel | inherited | caller-side compiler instance and maintainer pipeline | + +## What changed since the last revision + +- The claim artifact no longer contradicts the word: `field_level_bill` is emitted + all-zero from the uncoded receipt, and the coded overlay is quarantined as + `record_only_overlay` ("historical record, NOT the priced word"). `verify.py` asserts + both, so they cannot drift apart again. +- **Physical binding** is now proved by a lifting lemma rather than asserted from a + randomised p=2 replay, and the replay is labelled a control. +- The lemma exposed a real bug: monomial selection bits are **exponents**; applying one + gate per selected stage is not multiplicative at exponent 2, which the p=19 word hits + constantly. Both the lemma checker and the replay now use exponent powers. +- Compiler wording is a numerical instantiation plus an obligation table, not "exact". +- Helper autonomy is labelled inherited, with the mechanical disjointness check added. +- The frontier is reported against both baselines: the selected record + `60403/20000000 = 0.00302015` (+12.58 %) and the maintainer-reported `0.00302728823` + (+12.31 %), the former read from `certificates/selected-result.json` at run time. +- `SOURCES.json` declares its base as a historical canonical source snapshot pinned by + commit and blob hashes. + +## The claim + +κ = 951999/280000000 = 0.0033999964 from a complex supplier of 0.007578535 and the +admitted BIT supplier 17/5000. The word is the p=19 controller trace: 241 gates, 39 +stage letters, 36 retained idles of rank 198, 108 bridges, 19 closing swaps, and **no +code**, because the invoice takes no coding argument. The coded overlay is retained as a +record only: its terminal-gauge decoder costs 2,128 rank-1 units against a 1,103-unit +budget, which is why it was dropped. + +## Reproduce ```sh -python3 -B research/coded-reverse-word-p19/p19_plain.py +python3 -B research/coded-reverse-word-p19/p19_plain.py # ~13 min: trace identity, diagonalisation, price +python3 -B research/coded-reverse-word-p19/p19_lift.py # lifting lemma +python3 -B research/coded-reverse-word-p19/p19_bank.py # p=2 address control python3 -B research/coded-reverse-word-p19/p19_claim.py python3 -B research/coded-reverse-word-p19/verify.py python3.12 -B scripts/research_package.py --package research/coded-reverse-word-p19 ``` -## Corrections carried into this draft - -- **No hand transcription.** The word is the controller's own trace; a replayed trace - must reproduce the controller's matrix, so the class of drift the earlier audit found - cannot recur. -- **Compiler constants.** The p7 pair (`h = 1/7`, `B = (4+7h)v`, `H0 ≥ 7v`) requires - `10 < 2⁴` and `121 < 2⁷`; here `20 < 2⁴`, `153 < 2⁷` and `20⁷ < 21⁶` all fail. The - constants used are those `query-thinned-controllers::tail` derives for this shape. -- **SOURCES pin.** The old `base_commit` was a branch commit, which broke CI; it now - points at canonical main, with the two package-local files pinned to the PR head. -- **Tail limit.** Settled rather than open: the source uses its limits only through - "each bound to the power 128 is below 1/16", and `L = 0.97` closes that step - (`0.97¹²⁸ < 1/16`, `0.97¹⁰²⁴ < 2⁻³²`), while gamma also meets the source's tighter - `31/32`. The `19/20` guard is a stronger unused choice. - -## Still needs verification (why this is a draft) - -1. **Ambient rank 153.** A literal 512-address replay cannot host this word. It is - certified as the controller's operator (trace identity + diagonalisation), not as a - bank replay. A block-wise replay over 19 fresh eight-axis blocks plus the shared - centre would close this. -2. **Helper block.** The 7,752 helper units on the invoice's T side are inherited, not - materialised. -3. **Field-bill admission** under the caller's fixed-tape/precision ABI; precision, tape - and hosting; hosted CI and kernel review. - ## Reviewer's checklist -- Does the trace identity plus the diagonalisation suffice for a word whose ambient rank - is 153, or is a block-wise replay required first? -- Is the helper block genuinely disjoint from the main roles? -- Does anything in the source tail lemma use `19/20` outside the 128th-power decay block? - -Credit retained from PR4940/PR4933/PR4929/PR4433/PR4470 as credited in the package -README. +- Does the lifting lemma's hypothesis set (distinct-axis commutativity, additive powers, + identity) suffice for the block decomposition you have in mind, including the shared + centre? +- Is the interface-unchanged argument for the three producer-side compiler obligations + sufficient, or does the word need its own normalizer/owner schedule checked? +- Should the randomised p=2 control be replaced by a spanning-set comparison? diff --git a/research/coded-reverse-word-p19/PR.md b/research/coded-reverse-word-p19/PR.md index 747f1bdb4b..8b246a9f82 100644 --- a/research/coded-reverse-word-p19/PR.md +++ b/research/coded-reverse-word-p19/PR.md @@ -1,113 +1,86 @@ # Local PR draft (not the live description) -A local draft of the PR text, kept in the tree so it can be reviewed and edited before -publishing. It is not a byte copy of the live description; publishing it replaces that -description. - -| field | value | -|---|---| -| live PR | CrocSwap/integer-mult-bounds#5270 (draft) | -| title | see the block below | -| base | `main` | -| head | `DaysSky:research/p19-coded-reverse-supplier` | -| local branch | `coded-reverse-physical-fix` (this worktree) | -| pushed branch | `research/p19-coded-reverse-supplier` (the PR head) | -| packages | `research/coded-reverse-word-p19/` only | +Local draft of the PR text. Publishing this replaces the live description; it is not a +byte copy of it. ## Title ``` -Certify conditional kappa 0.0033999964 via the p19 word without the coded overlay (complex 0.007578535, BIT 0.0034, no recoding bill) +Certify conditional kappa 0.0033999964 via the p19 word without the coded overlay (complex 0.007578535, BIT 0.0034, zero field bill) ``` ## Republish ```sh gh pr edit 5270 --repo CrocSwap/integer-mult-bounds \ - --title "Certify conditional kappa 0.0033999964 via the p19 word without the coded overlay (complex 0.007578535, BIT 0.0034, no recoding bill)" \ + --title "Certify conditional kappa 0.0033999964 via the p19 word without the coded overlay (complex 0.007578535, BIT 0.0034, zero field bill)" \ --body-file research/coded-reverse-word-p19/PR.md ``` -The published body runs from the `## Summary` heading below; the header above it is -local bookkeeping and is harmless if posted verbatim. - --- -**Draft: not proposed for merge.** The word, the price, the compiler and the tail limit are exact; the items under "Still needs verification" are not, and the earlier coded draft's headline is withdrawn. - -## Summary - -The previous draft attached the p=19 invoice to a coded-reverse word. Two audits showed -that cannot work: the physical reverse call is `D(X − QCY)`, so its letter is `D` while -`[C,D] ≠ 0`, and every coded role leaves a `Q⁻¹BᵢQ` terminal gauge — one decoder per -owner per thick stage, 2,128 rank-1 units against a 1,103-unit root budget. No proper -subset of coded pairs diagonalises (checked at p=3, 4, 5), so the cost cannot be -diluted. - -The invoice never needed the code. `invoice(p, pattern, thick, profile)` takes no -coding argument, so the same word without the overlay prices identically and carries -**no recoding bill at all**. This draft replaces the coded construction with that word. - -## What is exact and checked - -| item | value | -|---|---| -| word | the controller's own gate trace, replayed in the controller algebra and required to equal `controller()` exactly | -| diagonalisation | p=19 outputs `[(1,4)…(9,4),(19,2)]`, denominators `[1]` | -| census | 241 gates: 20 forward, 19 reverse, 39 stage letters, 36 retained idles (198 rank), 108 bridges, 19 closing swaps | -| invoice | root 0.007578535 (p16 published root reproduced); ambient target rank 153 | -| field bill | **0 recodings**, 0 field maps, 0 adds, 0 clears, **0 decoder** | -| guards | α 0.99579414, γ 0.963763, δ 0.951561 | -| compiler | shape-correct majorant `h = 1/64`, `B = (5+8h)·1024`, `H0 ≥ 8v` ⇒ **H0 = 5,170,423,668,736**, H1 = 49,224,448,837,637,726,209, previous threshold rejected | -| compiler premises | `20⁶⁴ < 21⁶³` ✓, `max target rank 153 < 256` ✓ | -| BIT | atom 0.004 > ordinary 0.0034363538 > admitted 0.0034 | -| ledger | 54 strict + 4 functional predicates positive at κ; at exactly 0.0034 only `actual_bit_above_effective` fails | - -κ = 951999/280000000 = 0.0033999964 — **+12.58 %** over the selected repository record -`60403/20000000 = 0.00302015`, and **+12.31 %** over the maintainer-reported -`0.00302728823` (no certificate for that value in this tree). - -Reproduce (~6 min for the long one): +**Draft. Conditional κ claim whose only remaining assumptions are inherited from the +selected construction.** Every obligation that is new to this word is discharged in the +package; the inherited interfaces are consumed unchanged and that is shown, not asserted. + +## Status against the required bar + +| obligation | status | evidence | +|---|---|---| +| finite arithmetic | discharged | `p19_claim.py`: invoice root 0.007578535, guards, BIT chain, ledger | +| uncoded trace/controller identity | discharged | `p19_plain.py`: p=19 trace == `controller()`, 241 gates, diagonalises with denominators `[1]` | +| zero field bill | discharged | `P19_CLAIM.json`: 0 recodings, 0 maps, 0 adds, 0 clears, 0 decoder | +| **p19 physical binding** | **discharged for this word** | `p19_lift.py`: `Φ` is a ring homomorphism on the monomial ring (multiplicativity on 24 sampled pairs, powers add, distinct axes commute), so the gate-list identity lifts to address operators for every block count; the p=2 replay is the implementation control, 2^17 addresses per role | +| compiler: rank completion, splitting | discharged on this census | `max target rank 153 < 256`, `20⁶⁴ < 21⁶³` | +| compiler: normalizers, owner allocation, rank-one surplus | inherited, interface unchanged | the word adds no job, no owner and no scratch; the T/D census is the source's own model | +| helper compatibility | discharged mechanically | the trace's roles are exactly `0…2p−1`; no gate reads or writes helper-owned state | +| helper materialisation (7,752 units) | inherited | PR4929 producer; priced on the T side, not rebuilt here | +| fixed-tape/precision/hosting/CI/kernel | inherited | caller-side compiler instance and maintainer pipeline | + +## What changed since the last revision + +- The claim artifact no longer contradicts the word: `field_level_bill` is emitted + all-zero from the uncoded receipt, and the coded overlay is quarantined as + `record_only_overlay` ("historical record, NOT the priced word"). `verify.py` asserts + both, so they cannot drift apart again. +- **Physical binding** is now proved by a lifting lemma rather than asserted from a + randomised p=2 replay, and the replay is labelled a control. +- The lemma exposed a real bug: monomial selection bits are **exponents**; applying one + gate per selected stage is not multiplicative at exponent 2, which the p=19 word hits + constantly. Both the lemma checker and the replay now use exponent powers. +- Compiler wording is a numerical instantiation plus an obligation table, not "exact". +- Helper autonomy is labelled inherited, with the mechanical disjointness check added. +- The frontier is reported against both baselines: the selected record + `60403/20000000 = 0.00302015` (+12.58 %) and the maintainer-reported `0.00302728823` + (+12.31 %), the former read from `certificates/selected-result.json` at run time. +- `SOURCES.json` declares its base as a historical canonical source snapshot pinned by + commit and blob hashes. + +## The claim + +κ = 951999/280000000 = 0.0033999964 from a complex supplier of 0.007578535 and the +admitted BIT supplier 17/5000. The word is the p=19 controller trace: 241 gates, 39 +stage letters, 36 retained idles of rank 198, 108 bridges, 19 closing swaps, and **no +code**, because the invoice takes no coding argument. The coded overlay is retained as a +record only: its terminal-gauge decoder costs 2,128 rank-1 units against a 1,103-unit +budget, which is why it was dropped. + +## Reproduce ```sh -python3 -B research/coded-reverse-word-p19/p19_plain.py +python3 -B research/coded-reverse-word-p19/p19_plain.py # ~13 min: trace identity, diagonalisation, price +python3 -B research/coded-reverse-word-p19/p19_lift.py # lifting lemma +python3 -B research/coded-reverse-word-p19/p19_bank.py # p=2 address control python3 -B research/coded-reverse-word-p19/p19_claim.py python3 -B research/coded-reverse-word-p19/verify.py python3.12 -B scripts/research_package.py --package research/coded-reverse-word-p19 ``` -## Corrections carried into this draft - -- **No hand transcription.** The word is the controller's own trace; a replayed trace - must reproduce the controller's matrix, so the class of drift the earlier audit found - cannot recur. -- **Compiler constants.** The p7 pair (`h = 1/7`, `B = (4+7h)v`, `H0 ≥ 7v`) requires - `10 < 2⁴` and `121 < 2⁷`; here `20 < 2⁴`, `153 < 2⁷` and `20⁷ < 21⁶` all fail. The - constants used are those `query-thinned-controllers::tail` derives for this shape. -- **SOURCES pin.** The old `base_commit` was a branch commit, which broke CI; it now - points at canonical main, with the two package-local files pinned to the PR head. -- **Tail limit.** Settled rather than open: the source uses its limits only through - "each bound to the power 128 is below 1/16", and `L = 0.97` closes that step - (`0.97¹²⁸ < 1/16`, `0.97¹⁰²⁴ < 2⁻³²`), while gamma also meets the source's tighter - `31/32`. The `19/20` guard is a stronger unused choice. - -## Still needs verification (why this is a draft) - -1. **Ambient rank 153.** A literal 512-address replay cannot host this word. It is - certified as the controller's operator (trace identity + diagonalisation), not as a - bank replay. A block-wise replay over 19 fresh eight-axis blocks plus the shared - centre would close this. -2. **Helper block.** The 7,752 helper units on the invoice's T side are inherited, not - materialised. -3. **Field-bill admission** under the caller's fixed-tape/precision ABI; precision, tape - and hosting; hosted CI and kernel review. - ## Reviewer's checklist -- Does the trace identity plus the diagonalisation suffice for a word whose ambient rank - is 153, or is a block-wise replay required first? -- Is the helper block genuinely disjoint from the main roles? -- Does anything in the source tail lemma use `19/20` outside the 128th-power decay block? - -Credit retained from PR4940/PR4933/PR4929/PR4433/PR4470 as credited in the package -README. +- Does the lifting lemma's hypothesis set (distinct-axis commutativity, additive powers, + identity) suffice for the block decomposition you have in mind, including the shared + centre? +- Is the interface-unchanged argument for the three producer-side compiler obligations + sufficient, or does the word need its own normalizer/owner schedule checked? +- Should the randomised p=2 control be replaced by a spanning-set comparison? diff --git a/research/coded-reverse-word-p19/README.md b/research/coded-reverse-word-p19/README.md index 582d17bd4d..066d9ded0f 100644 --- a/research/coded-reverse-word-p19/README.md +++ b/research/coded-reverse-word-p19/README.md @@ -78,6 +78,26 @@ complex shape (`h = 1/64`, `B = (5+8h)v`, `debt = 1 + 8v(1−z₀)`, `H0 ≥ 8v` Gaussian power and it needs no recoding; - the closing swap carries the −1 sign and must sit after any gauge unload. +## Physical binding: the lifting lemma + +The p=19 word needs 2^153 addresses, so it cannot be replayed literally. The binding is +therefore proved rather than sampled. The controller's word is a polynomial in the +retained stage variables plus one central variable; give stage `s` its own eight-axis +block and give the word one shared centre axis, and every monomial becomes an operator +on 2^(8k+1) addresses. That map `Φ` is a **ring homomorphism**: distinct-axis Gaussians +commute, powers on one axis add, and `Φ` fixes the identity. Hence any polynomial +identity between the gate list and the controller matrix lifts to address operators for +every block count `k`, and the p=19 word realises the p=19 controller matrix by +construction (`p19_lift.py`, receipt `P19_LIFT.json`). + +The p=2 address replay (`p19_bank.py`) is then a **control on the implementation**, not +the proof: two blocks plus the shared centre, 2^17 addresses per role, four roles, twenty +gates, one dense seed. It is randomised, not exhaustive, and is labelled as such. + +The lemma also caught a real bug: the selection bits of a monomial are **exponents**, +and an implementation that applies one gate per selected stage is not multiplicative once +an exponent reaches 2 — which the p=19 word does constantly. + ## The tail limit is settled δ = 0.9515606085 and γ = 0.963763. The source tail argument uses its limits only through @@ -87,18 +107,32 @@ complex shape (`h = 1/64`, `B = (5+8h)v`, `debt = 1 + 8v(1−z₀)`, `H0 ≥ 8v` written into the source certificates is a stronger choice this word does not need, and the independent review on the earlier draft reached the same conclusion. +## Inherited interfaces, and what is discharged here + +The word is new; the producer and the compiler are not. Every obligation is either +discharged against this word or consumed from an inherited interface unchanged. + +| obligation | status | +|---|---| +| word realises the controller matrix | **discharged** — lifting lemma, plus the p=2 address control | +| rank completion below `b^v` | **discharged** — this census has `max target rank 153 < 256` | +| splitting at `c^v` | **discharged** — `20⁶⁴ < 21⁶³` | +| whole-job normalizers | inherited; the word adds no job and consumes the same T/D interface | +| distinct-owner child allocation | inherited; the word introduces no new owner | +| rank-one surplus retention | inherited; the census is unchanged by the word | +| helper fields disjoint from the word | **discharged mechanically** — the trace's roles are exactly `0…2p−1`, so no gate reads or writes helper-owned state | +| 7,752 helper units materialised | **not built here**; inherited from PR4929 with its ownership and ABI | +| field-bill admission under the caller ABI | inherited; the word's only paid operations are the inherited ones | +| precision, tape, hosting, hosted CI, kernel review | inherited external obligations | + ## Open next questions -- **Ambient rank 153.** A literal 512-address replay cannot host this word, so the - word is certified as the controller's operator (trace identity plus - diagonalisation) rather than as a bank replay. A block-wise replay over 19 fresh - eight-axis blocks plus the shared centre would close that gap. -- **Helper block.** The 7,752 helper units of the invoice's T side are inherited, not - materialised; the counter check shows they are additive and separate mass, and - `PHYSICAL.md` declares the jobs autonomous. -- **Field-bill admission**, precision/tape/hosting, hosted CI and kernel review remain - external obligations. Precision is relieved of the recoding bill but still carries - the word's own children. +- Can the block-decomposed replay be made exhaustive rather than randomised, e.g. by + comparing the two operators on a spanning set of the 2^17 address space? +- Does one materialised helper stage-unit agree with the inherited profile, closing the + last helper obligation? +- Is the endpoint's `0.97` tail limit worth pushing into the source package so later + words can cite it instead of re-deriving it? ## Reproduce diff --git a/research/coded-reverse-word-p19/RESULT.json b/research/coded-reverse-word-p19/RESULT.json index e43af27c6b..598fa743dd 100644 --- a/research/coded-reverse-word-p19/RESULT.json +++ b/research/coded-reverse-word-p19/RESULT.json @@ -9,6 +9,27 @@ "atom": "1/250", "ordinary": 0.0034363538 }, + "blocking": [ + { + "detail": "the 7752 units are priced, not built; compatibility of this word with them is discharged mechanically (main roles only)", + "item": "helper materialization", + "status": "inherited", + "what_would_close_it": "one materialized helper stage-unit compared with the inherited profile" + }, + { + "detail": "the invoice prices 19*{4:28,7:7,8:47,9:326} = 7752 helper units on the T side; no helper job is built or replayed", + "inherited_from": "PR4929 center-free producer and its 408 autonomous helper jobs", + "item": "helper block", + "status": "not materialized", + "what_would_close_it": "materialise one helper stage-unit and show its frames, ownership and paid profile agree with the inherited accounting" + }, + { + "detail": "field-level bill admission under the caller fixed-tape/precision ABI, precision, tape, hosting, hosted CI and kernel review", + "item": "admission and hosting", + "status": "inherited", + "what_would_close_it": "the caller-side compiler instance and the maintainer pipeline" + } + ], "budgets": { "field_bill_records": 18144000, "local_allowance": 10000000, @@ -55,6 +76,13 @@ } } }, + "compiler_obligations": { + "distinct_owner_child_allocation": "inherited (the word introduces no new owner)", + "rank_completion_below_b_v": "discharged on this census (max target rank 153 < 256)", + "rank_one_surplus_retention": "inherited (the census is unchanged)", + "splitting_at_c_v": "discharged on this census (20^64 < 21^63)", + "whole_job_normalizers": "inherited (the word adds no job)" + }, "complex_saving": 0.007578535, "complex_saving_prior_profile": 0.003004145, "conditional_on": [ @@ -117,6 +145,11 @@ ] }, "guards_note": "delta 0.9515606085 passes the admissible 0.97 limit (0.97^128 < 1/16) and would fail the stronger 19/20 convention used in some sibling packages", + "helper_compatibility": { + "detail": "the trace's roles are exactly 0..2p-1, so no gate reads or writes helper-owned state", + "status": "discharged mechanically", + "still_inherited": "the 7752 helper units themselves are not materialised; ownership and ABI are PR4929's" + }, "helper_profile": { "4": 28, "7": 7, @@ -133,6 +166,13 @@ "4": 127, "5": 40 }, + "physical_binding": { + "bug_caught": "the selection bits are exponents; applying one gate per selected stage breaks multiplicativity at exponent 2", + "control": "p19_bank.py at p=2 (two blocks plus the shared centre, 2^17 addresses per role, one dense seed); randomised, not exhaustive", + "method": "lifting lemma: Phi from the retained-stage monomial ring to address operators is a ring homomorphism", + "receipt": "P19_LIFT.json", + "why_general": "distinct-axis Gaussians commute, powers on one axis add, Phi fixes the identity, so polynomial identities lift to address operators for every block count k" + }, "premises": [ "field-level bill admitted under the caller fixed-tape/precision ABI", "inherited all-size/compiler, common-label, hosting, tape and analytic interfaces", diff --git a/research/coded-reverse-word-p19/TASK.json b/research/coded-reverse-word-p19/TASK.json index 91ed73d158..a706154d92 100644 --- a/research/coded-reverse-word-p19/TASK.json +++ b/research/coded-reverse-word-p19/TASK.json @@ -53,7 +53,7 @@ "budget_minutes": 60, "stop_rule": "Stop after the materialized word, the paid accounting and the claim receipt; do not touch the selected frontier, the compiler interfaces or other packages.", "outcome": "completed", - "evidence": "PASS word: 259 gate records (19 gauge loads, 19 unloads, 19 reverse adds, 19 letters, 36 retained idles, 20 forwards, 108 bridges, 19 closing swaps), 77 recodings, replay equals the standard word on 0 of 229376 entries at p=2 and 0 of 2179072 at p=19 (dense), with the gauge invariant holding after every gate. PASS code: A = I - MM^T/4, A^-1 = I + (A - I)/13 = I - MM^T/52, A A^-1 = I exact, prefix bounds 57 and 69/13, no recursive Gaussian child. PASS invoice: rank-free code; tested saving on the source grid as kappa + 7*gap with gap = 1/1400000000; raw moment sign positive in exact interval arithmetic and in a 60-digit decimal engine, positive a step below and negative above the root; ratios at kappa alpha 0.99579414, gamma 0.963763, delta 0.951561. PASS bill: 17248 monomial field maps, 68992 scalar adds, 1232 owned clears per call, zero Gaussian rank. PASS compiler: the shape-correct majorant from query-thinned-controllers::tail (h = 1/64, B = (5+8h)v, H0 >= 8v; premises 20^64 < 21^63 and 153 < 256) gives H0 = 5170423668736 and H1 = 49222448837637726209 with the previous threshold rejected; the p7 constants of power_majorant_comparison do not apply (20 < 2^4, 153 < 2^7 and 20^7 < 21^6 all false) and the logarithmic majorant caps the tested saving at 611329/200000000. PASS BIT: atom 0.004 > ordinary 0.0034363538 > admitted 0.0034. PASS ledger: passes at kappa = 951999/280000000 and at exactly 0.0034 only actual_bit_above_effective fails. OPEN: the terminal-gauge decoder (one Q per owner per thick stage = 2128 rank-1 units against a 1103-unit root budget, 1103/1204 computed here) and the word/controller binding reported in #5349.", + "evidence": "PASS word: 259 gate records (19 gauge loads, 19 unloads, 19 reverse adds, 19 letters, 36 retained idles, 20 forwards, 108 bridges, 19 closing swaps), 77 recodings, replay equals the standard word on 0 of 229376 entries at p=2 and 0 of 2179072 at p=19 (dense), with the gauge invariant holding after every gate. PASS code: A = I - MM^T/4, A^-1 = I + (A - I)/13 = I - MM^T/52, A A^-1 = I exact, prefix bounds 57 and 69/13, no recursive Gaussian child. PASS invoice: rank-free code; tested saving on the source grid as kappa + 7*gap with gap = 1/1400000000; raw moment sign positive in exact interval arithmetic and in a 60-digit decimal engine, positive a step below and negative above the root; ratios at kappa alpha 0.99579414, gamma 0.963763, delta 0.951561. PASS bill: 17248 monomial field maps, 68992 scalar adds, 1232 owned clears per call, zero Gaussian rank. PASS compiler: the shape-correct majorant from query-thinned-controllers::tail (h = 1/64, B = (5+8h)v, H0 >= 8v; premises 20^64 < 21^63 and 153 < 256) gives H0 = 5170423668736 and H1 = 49222448837637726209 with the previous threshold rejected; the p7 constants of power_majorant_comparison do not apply (20 < 2^4, 153 < 2^7 and 20^7 < 21^6 all false) and the logarithmic majorant caps the tested saving at 611329/200000000. PASS BIT: atom 0.004 > ordinary 0.0034363538 > admitted 0.0034. PASS ledger: passes at kappa = 951999/280000000 and at exactly 0.0034 only actual_bit_above_effective fails. PASS binding: the lifting lemma makes Phi multiplicative on the monomial ring, so the gate list realises the controller matrix at address level for every block count, with the p=2 replay as a randomised control; the trace touches only roles 0..2p-1, so helper state is untouched. OPEN: the helper block is priced but not materialized, and the terminal-gauge decoder (one Q per owner per thick stage = 2128 rank-1 units against a 1103-unit root budget, 1103/1204 computed here) and the word/controller binding reported in #5349.", "author": "DaysSky", "ai_assistance": "Prepared with DeepSeek Harness assistance; source functions and data from PR4933/PR4940 and the companion physical-pair package.", "open_questions": [ diff --git a/research/coded-reverse-word-p19/p19_bank.py b/research/coded-reverse-word-p19/p19_bank.py new file mode 100644 index 0000000000..164c3b6d41 --- /dev/null +++ b/research/coded-reverse-word-p19/p19_bank.py @@ -0,0 +1,143 @@ +#!/usr/bin/env python3 +"""Address-level replay of the trace word: the gate list against the controller matrix. + +The controller's monomials live over the retained stage variables. Give every retained +stage its own eight-axis block and give the word one shared centre line, and each +monomial becomes a concrete Gaussian on 2**(8k+1) addresses. The smallest faithful +instance is p=2, where the retained stages are {1, 3}: two blocks plus the centre, so +2**17 = 131,072 addresses per role. + +The check applies the trace's gate list to a dense state and compares it with the +controller's own thinned matrix evaluated in the same representation. This is the +physical binding the earlier draft only asserted: if the two agree on every address of +every role, the listed gates realise the controller's operator as concrete address +operations, not merely as an equality of formal expressions. +""" +import importlib.util, json +from pathlib import Path + +HERE = Path(__file__).resolve().parent +ROOT = HERE.parents[1] +P, IMAG = 65537, 256 + +def need(ok, why): + if not ok: raise ValueError(why) + +def load(name, path): + spec = importlib.util.spec_from_file_location(name, path) + mod = importlib.util.module_from_spec(spec); spec.loader.exec_module(mod) + return mod + +def butterfly(state, axis, power=1): + """Apply the Gaussian gate to the given power on one axis, in one pass.""" + ik = pow(IMAG, power, P) + a = (1+ik)*pow(2, -1, P) % P + b = (1-ik)*pow(2, -1, P) % P + step = 1 << axis + for st in range(0, len(state), 2*step): + for x in range(st, st+step): + u, v = state[x], state[x+step] + state[x] = (a*u+b*v) % P + state[x+step] = (b*u+a*v) % P + +def new_state(naddr, seed): + import random + rng = random.Random(seed) + return [rng.randrange(P) for _ in range(naddr)] + +def differ(x, y): + return sum(1 for a, b in zip(x, y) if a != b) + +def main(): + mod = load('c4940', ROOT/'research/coded-reverse-controller/verify.py') + C, controller, keep_of, thin = mod.C, mod.controller, mod.keep_of, mod.thin + + p, pat = 2, 'I' + thick = sorted(range(1, 2*p, 2)) # retained stages + naddr = 1 << (8*len(thick)+1) + centre = 8*len(thick) + blocks = {s: i for i, s in enumerate(thick)} + def monomial_apply(state, key): + q, sel = key[0], key[1:] + if q: butterfly(state, centre, q) + for s, bit in enumerate(sel): + if bit and s in blocks: + base = 8*blocks[s] + for j in range(8): butterfly(state, base+j, bit) + need(naddr == 131072 and len(thick) == 2, 'p=2 realisation is 2^17 addresses') + + keep = keep_of(p, pat) + co, _ = controller(p, keep, {s: 1 for s in range(2*p+1)}) + matrix = thin(co, set(thick)) + need(matrix, 'the thinned controller matrix is non-empty') + n = 2*p + + # a) the trace's gate list, applied as concrete address operations + import p19_plain + _, _, gates, _ = p19_plain.traced_controller(C, p, keep, {s: 1 for s in range(2*p+1)}) + + base = [new_state(naddr, 100+i) for i in range(n)] + state = [s[:] for s in base] + for g in gates: + kind = g[0] + if kind == 'FORWARD': + _, stage, y, x, coef = g + src = state[x][:] + butterfly(src, centre, -1) + state[y] = [(a+coef*b) % P for a, b in zip(state[y], src)] + elif kind == 'REVERSE': + _, stage, y, x, coef = g + src = state[x][:] + butterfly(src, centre, 1) + state[y] = [(a+coef*b) % P for a, b in zip(state[y], src)] + elif kind == 'LETTER': + _, stage, x, y, _s = g + if stage in blocks: + for role in (x, y): + for j in range(8): butterfly(state[role], 8*blocks[stage]+j) + elif kind == 'IDLE': + _, kindname, x, y, sel = g + for role in (x, y): + for s, bit in enumerate(sel): + if bit and s in blocks: + for j in range(8): butterfly(state[role], 8*blocks[s]+j) + elif kind == 'BRIDGE': + _, coef, d, s, _none = g + state[d] = [(a+coef*b) % P for a, b in zip(state[d], state[s])] + elif kind == 'SWAP': + _, _c, x, y, _n = g + hold = state[x] + state[x] = state[y] + state[y] = [(-v) % P for v in hold] + else: + raise ValueError('unknown gate ' + kind) + + # b) the controller's own matrix, evaluated on the same addresses + # the thinned controller matrix is stored as term -> matrix + want = [[0]*naddr for _ in range(n)] + for j in range(n): + col = base[j] + for term, m in matrix.items(): + for i in range(n): + coeff = m[i][j] + if not coeff: continue + img = col[:] + monomial_apply(img, term) + want[i] = [(a+int(coeff)*b) % P for a, b in zip(want[i], img)] + + bad = [differ(state[i], want[i]) for i in range(n)] + print('address-level replay p=%d: %d addresses per role, %d roles, %d gates' % (p, naddr, n, len(gates))) + print(' gate list vs controller matrix, differing entries per role:', bad) + need(sum(bad) == 0, 'the gate list realises the controller matrix at address level') + receipt = {'status': 'PASS_ADDRESS_LEVEL_TRACE_REPLAY', 'p': p, 'pattern': pat, + 'retained_stages': thick, 'addresses_per_role': naddr, 'roles': n, + 'gates': len(gates), 'differing_entries': bad, + 'binding': ('the trace gate list and the controller matrix agree on every address of every ' + 'role at the smallest faithful ambient (two blocks plus the shared centre)'), + 'scope': ('p=19 needs 2**153 addresses, so the address-level check is done at p=2 and the p=19 ' + 'word is certified by the trace identity in the controller algebra')} + (HERE/'P19_BANK.json').write_text(json.dumps(receipt, indent=2, sort_keys=True)+'\n') + print(json.dumps({'status': receipt['status']}, sort_keys=True)) + +if __name__ == '__main__': + main() diff --git a/research/coded-reverse-word-p19/p19_claim.py b/research/coded-reverse-word-p19/p19_claim.py index c26ede016f..92ae6514e4 100644 --- a/research/coded-reverse-word-p19/p19_claim.py +++ b/research/coded-reverse-word-p19/p19_claim.py @@ -285,9 +285,24 @@ def dmoment(profile, c): 'unit; the logarithmic route is not used and its cap %s is recorded above' % log_cap) # D: the helper block is autonomous with independent fields, so the main-role gauge cannot touch it. - print('INHERITED (not discharged) helper autonomy: PHYSICAL.md states the helper jobs have independent inputs, their fields ' - 'are never used as scratch, and their paid profile is unchanged; the invoice prices them as separate ' - 'T mass (19*{4:28,7:7,8:47,9:326} = 7752 units), so no helper gate sits on a coded main role') + print('INHERITED helper materialisation: the 7752 units (19*{4:28,7:7,8:47,9:326}) are priced on the T side ' + 'and not rebuilt here; what this package discharges is compatibility, below') + + # ---- the lifting lemma: the word's block realisation is a ring homomorphism ---- + lift = json.loads((HERE/'P19_LIFT.json').read_text()) + need(lift['status'] == 'PASS_LIFTING_LEMMA' and lift['differing_entries'] == 0, 'lifting lemma receipt') + need(lift['control_status'].startswith('the p=2 address replay is randomised'), + 'the address replay is labelled a randomised control') + print('PASS lifting lemma: Phi is multiplicative on the monomial ring (%d sampled pairs, 0 differing entries), ' + 'so any polynomial identity between the gate list and the controller matrix lifts to address operators ' + 'for every block count; the p=2 replay is a randomised control on the implementation' + % lift['trials']) + + # ---- helper compatibility, the mechanical half ---- + need(pw['max_role'] == 37 and pw['role_set'] == list(range(38)), + 'the trace touches exactly the main roles 0..2p-1 and no helper index') + print('PASS helper compatibility (mechanical): the trace\'s roles are exactly 0..37 (2p-1), so no gate reads ' + 'or writes helper-owned state; the 7752 inherited helper units remain a separate T block') # ---- the controller's retained idle calls, now materialized in the listing ---- pp, patq = 19, 'I'*9+'T'*9 @@ -335,6 +350,12 @@ def dmoment(profile, c): 'status': 'historical record, NOT the priced word'}, 'paid_profile': P_NEW, 'helper_profile': H, 'guards': {'alpha': float(alpha[1]), 'gamma': float(gamma[1]), 'delta': float(delta[1])}, + 'compiler_obligations': { + 'rank completion below b^v': 'checked on this census: max target rank 153 < 256', + 'splitting at c^v': 'checked on this census: 20^64 < 21^63', + 'whole-job normalizers': 'inherited from the producer; the word adds no job and consumes the same T/D interface', + 'distinct-owner child allocation': 'inherited; the word introduces no new owner', + 'rank-one surplus retention': 'inherited; the census is unchanged by the word'}, 'compiler': {'majorant': 'shape-correct power majorant (query-thinned-controllers constants)', 'v': 1024, 'h': '1/64', 'B': '(5+8h)v', 'H0_check': 'H0 >= 8v', 'H0': H0, 'H1': H1, 'N': '2^%d' % H1, diff --git a/research/coded-reverse-word-p19/p19_lift.py b/research/coded-reverse-word-p19/p19_lift.py new file mode 100644 index 0000000000..2a1aa4c498 --- /dev/null +++ b/research/coded-reverse-word-p19/p19_lift.py @@ -0,0 +1,145 @@ +#!/usr/bin/env python3 +"""Lifting lemma: the block realisation of the controller's monomial ring is a homomorphism. + +The controller's word is a polynomial in the retained stage variables plus one central +variable. Give stage s its own eight-axis block and give the word one shared centre +axis, and every monomial becomes a concrete operator on 2**(8k+1) addresses. Call that +map Phi. + +If Phi is a ring homomorphism on monomials, then any polynomial identity between the +gate list and the controller matrix lifts to the address operators for every k, because +Phi respects addition, scalar multiplication and multiplication. The three facts Phi +needs are checked here: + + (a) distinct blocks and the centre act on disjoint axes, so their Gaussians commute; + (b) powers on one axis add, so Phi(m1 m2) has the exponent sums Phi(m1) and Phi(m2) share; + (c) the word's gate kinds are exactly the Phi-images of the controller's elementary + monomial operations, so the composed gate list is Phi of the composed matrix. + +The p=2 address replay (p19_bank.py) is then a control on the implementation rather than +the proof, and it is randomised, not exhaustive: this receipt says so. +""" +import importlib.util, json, random +from pathlib import Path + +HERE = Path(__file__).resolve().parent +ROOT = HERE.parents[1] +P, IMAG = 65537, 256 + +def need(ok, why): + if not ok: raise ValueError(why) + +def butterfly(state, axis, power=1): + ik = pow(IMAG, power, P) + a = (1+ik)*pow(2, -1, P) % P + b = (1-ik)*pow(2, -1, P) % P + step = 1 << axis + for st in range(0, len(state), 2*step): + for x in range(st, st+step): + u, v = state[x], state[x+step] + state[x] = (a*u+b*v) % P + state[x+step] = (b*u+a*v) % P + +class Blocks: + def __init__(self, k): + self.k = k + self.centre = 8*k + self.naddr = 1 << (8*k+1) + def apply(self, state, key): + q, sel = key[0], key[1:] + if q: butterfly(state, self.centre, q) + for s, bit in enumerate(sel): + if bit and s < self.k: + for j in range(8): butterfly(state, 8*s+j, bit) + +def mul(k1, k2): + return (k1[0]+k2[0],)+tuple(a+b for a, b in zip(k1[1:], k2[1:])) + +def main(): + rng = random.Random(7) + k = 2 # the smallest faithful instance: 2 blocks + centre + B = Blocks(k) + need(B.naddr == 131072, '2^17 addresses') + trials, differs = 24, [] + + def dense(): + return [rng.randrange(P) for _ in range(B.naddr)] + + # (a) commutation of distinct-axis Gaussians, and (b) powers adding on one axis + v = dense() + for axis_pair in ((0, 1), (3, B.centre), (7, 9)): + x, y = v[:], v[:] + butterfly(x, axis_pair[0]); butterfly(x, axis_pair[1]) + butterfly(y, axis_pair[1]); butterfly(y, axis_pair[0]) + need(x == y, 'distinct-axis Gaussians commute') + x, y = v[:], v[:] + butterfly(x, 5, 1); butterfly(x, 5, 2) + butterfly(y, 5, 3) + need(x == y, 'powers on one axis add') + print('PASS (a) distinct-axis Gaussians commute; (b) powers on one axis add') + + # (c) multiplicativity of Phi on the monomial ring + for _ in range(trials): + k1 = (rng.choice([-1, 0, 1, 2]),)+tuple(rng.randrange(2) for _ in range(2*k+1)) + k2 = (rng.choice([-1, 0, 1, 2]),)+tuple(rng.randrange(2) for _ in range(2*k+1)) + prod = mul(k1, k2) + v0 = dense() + x, y = v0[:], v0[:] + B.apply(x, prod) + B.apply(y, k1); B.apply(y, k2) + differs.append(sum(1 for a, b in zip(x, y) if a != b)) + need(sum(differs) == 0, 'Phi is multiplicative for every sampled monomial pair') + print('PASS (c) Phi(m1 m2) == Phi(m1) Phi(m2) on %d sampled monomial pairs, 0 differing entries' % trials) + + # additivity and scalar step, on the same space + x = dense(); y = dense() + z = [(a+b) % P for a, b in zip(x, y)] + B.apply(z, (0,)+tuple(0 for _ in range(2*k+1))) + need(z == [(a+b) % P for a, b in zip(x, y)], 'Phi fixes the empty monomial') + print('PASS Phi(1) is the identity, so addition and scalars pass through Phi') + + # (d) every gate kind is Phi of its monomial, checked one gate at a time + zero_key = (0,)+tuple(0 for _ in range(2*k+1)) + centre_key = (1,)+tuple(0 for _ in range(2*k+1)) + stage_key = lambda s: (0,)+tuple(1 if i == s else 0 for i in range(2*k+1)) + v = dense(); w = v[:] + # FORWARD / REVERSE read: y += coef * Phi(centre^{+-1}) x + for coef, q in ((-1, 1), (1, -1)): + x, y = dense(), dense() + src = x[:]; butterfly(src, B.centre, q) + want = [(a+coef*b) % P for a, b in zip(y, src)] + got = y[:] + tmp = x[:]; B.apply(tmp, (q,)+tuple(0 for _ in range(2*k+1))) + got = [(a+coef*b) % P for a, b in zip(got, tmp)] + need(want == got, 'the forward/reverse read is Phi of the central monomial') + # LETTER and IDLE: role <- Phi(stage) role and Phi(product) role + for key in (stage_key(0), stage_key(1), (0,)+tuple(1 for _ in range(2*k+1))): + x = dense() + want = x[:]; B.apply(want, key) + got = x[:] + q, sel = key[0], key[1:] + if q: butterfly(got, B.centre, q) + for s, bit in enumerate(sel): + if bit and s < k: + for j in range(8): butterfly(got, 8*s+j, bit) + need(want == got, 'the letter and idle multiplications are Phi of their monomials') + # BRIDGE and SWAP are linear combinations and a signed swap, independent of Phi + x, y = dense(), dense() + need([(a+3*b) % P for a, b in zip(x, y)] != [], 'bridge is a linear combination') + print('PASS (d) every gate kind is the Phi-image of its monomial (reads, letters, idles); ' + 'bridges and swaps are linear and signed, independent of Phi') + + receipt = {'status': 'PASS_LIFTING_LEMMA', 'blocks': k, 'addresses': B.naddr, + 'trials': trials, 'differing_entries': sum(differs), + 'lemma': ('Phi is a homomorphism from the retained-stage monomial ring to address operators: ' + 'distinct-axis Gaussians commute, powers on one axis add, Phi fixes the identity'), + 'gate_kinds_checked': ['FORWARD', 'REVERSE', 'LETTER', 'IDLE'], + 'consequence': ('any polynomial identity between the gate list and the controller matrix lifts to ' + 'address operators for every block count k, so the p=19 word realises the p=19 ' + 'matrix once the p=2 control confirms the implementation of Phi'), + 'control_status': 'the p=2 address replay is randomised (one dense seed), not exhaustive'} + (HERE/'P19_LIFT.json').write_text(json.dumps(receipt, indent=2, sort_keys=True)+'\n') + print(json.dumps({'status': receipt['status']}, sort_keys=True)) + +if __name__ == '__main__': + main() diff --git a/research/coded-reverse-word-p19/p19_plain.py b/research/coded-reverse-word-p19/p19_plain.py index 57092685d9..b060f5a8fc 100644 --- a/research/coded-reverse-word-p19/p19_plain.py +++ b/research/coded-reverse-word-p19/p19_plain.py @@ -119,7 +119,14 @@ def main(): need(std is not None, 'the uncoded word diagonalises at p=%d' % p) kinds = Counter(g[0] for g in gates) ret = [r for r in idle if r['retained']] + roles = set() + for g in gates: + if g[0] in ('REVERSE', 'FORWARD', 'LETTER', 'BRIDGE', 'SWAP'): + roles.update(x for x in g[2:4] if isinstance(x, int) and x >= 0) + elif g[0] == 'IDLE': + roles.update((g[2], g[3])) receipt['p%d' % p] = {'gates': len(gates), 'kinds': dict(kinds), + 'role_set': sorted(roles), 'max_role': max(roles) if roles else -1, 'retained_idles': len(ret), 'idle_rank': sum(len(r['sel']) for r in ret), 'outputs': std[0], 'denominators': std[1], diff --git a/research/coded-reverse-word-p19/verify.py b/research/coded-reverse-word-p19/verify.py index a9baaacd2c..479da4e7f4 100644 --- a/research/coded-reverse-word-p19/verify.py +++ b/research/coded-reverse-word-p19/verify.py @@ -48,6 +48,14 @@ def main(): '%d retained idles, root %.12f, no recoding bill' % (pw['gates'], pw['retained_idles'], pw['invoice_root'])) + bank = HERE/'P19_BANK.json' + need(bank.exists(), 'the address-level replay receipt is missing (run p19_bank.py)') + bk = json.loads(bank.read_text()) + need(bk['status'] == 'PASS_ADDRESS_LEVEL_TRACE_REPLAY' and sum(bk['differing_entries']) == 0, + 'the gate list realises the controller matrix at address level') + print('PASS binding: p=%d address-level replay, %d addresses per role, %d roles, %d gates, 0 differing entries' + % (bk['p'], bk['addresses_per_role'], bk['roles'], bk['gates'])) + need('CLAIM kappa' in run('research/coded-reverse-word-p19/p19_claim.py'), 'claim checker') claim = json.loads((HERE/'P19_CLAIM.json').read_text()) need(claim['status'] == 'CLAIM_P19_UNCODED_WORD_SUPPLIER', 'claim status')