From ecbc47ccde755dfc4571a3d60da1eb334aa070cd Mon Sep 17 00:00:00 2001 From: Ross Richardson Date: Wed, 14 Oct 2026 08:43:06 +1100 Subject: [PATCH 1/2] Research: cyclic output frames reduce fixed-reader restoration --- .../CERTIFICATE.json | 304 +++++++++++++++++ research/cyclic-output-restoration/CLAIM.md | 39 +++ .../cyclic-output-restoration/FIXTURE.json | 189 +++++++++++ .../PREDECESSORS.json | 29 ++ research/cyclic-output-restoration/README.md | 268 +++++++++++++++ .../cyclic-output-restoration/SOURCES.json | 42 +++ research/cyclic-output-restoration/TASK.json | 69 ++++ .../cyclic-output-restoration/VALIDATION.md | 44 +++ .../cyclic-output-restoration/VERIFY.json | 31 ++ research/cyclic-output-restoration/model.py | 153 +++++++++ research/cyclic-output-restoration/oracle.py | 150 +++++++++ .../sources/PR1145-README.md | 101 ++++++ .../sources/PR1203-README.md | 315 ++++++++++++++++++ .../sources/PR1227-README.md | 240 +++++++++++++ .../cyclic-output-restoration/test_package.py | 123 +++++++ research/cyclic-output-restoration/verify.py | 208 ++++++++++++ 16 files changed, 2305 insertions(+) create mode 100644 research/cyclic-output-restoration/CERTIFICATE.json create mode 100644 research/cyclic-output-restoration/CLAIM.md create mode 100644 research/cyclic-output-restoration/FIXTURE.json create mode 100644 research/cyclic-output-restoration/PREDECESSORS.json create mode 100644 research/cyclic-output-restoration/README.md create mode 100644 research/cyclic-output-restoration/SOURCES.json create mode 100644 research/cyclic-output-restoration/TASK.json create mode 100644 research/cyclic-output-restoration/VALIDATION.md create mode 100644 research/cyclic-output-restoration/VERIFY.json create mode 100644 research/cyclic-output-restoration/model.py create mode 100644 research/cyclic-output-restoration/oracle.py create mode 100644 research/cyclic-output-restoration/sources/PR1145-README.md create mode 100644 research/cyclic-output-restoration/sources/PR1203-README.md create mode 100644 research/cyclic-output-restoration/sources/PR1227-README.md create mode 100644 research/cyclic-output-restoration/test_package.py create mode 100644 research/cyclic-output-restoration/verify.py diff --git a/research/cyclic-output-restoration/CERTIFICATE.json b/research/cyclic-output-restoration/CERTIFICATE.json new file mode 100644 index 0000000000..d93928ba10 --- /dev/null +++ b/research/cyclic-output-restoration/CERTIFICATE.json @@ -0,0 +1,304 @@ +{ + "admission": { + "admitted": 27, + "matrices": 19683, + "rejected": 19656 + }, + "base": "dadfea6e8a78ff6ba901705f87532a71c6f5bbb8", + "boundary": { + "census": [ + { + "admitted": 3, + "k": 1, + "operation_pairs": [ + [ + 1, + 0 + ], + [ + 1, + 2 + ], + [ + 2, + 2 + ] + ], + "schedules": 81 + }, + { + "admitted": 9, + "k": 2, + "operation_pairs": [ + [ + 1, + 2 + ], + [ + 1, + 3 + ], + [ + 2, + 0 + ], + [ + 2, + 2 + ], + [ + 3, + 2 + ], + [ + 3, + 3 + ] + ], + "schedules": 729 + }, + { + "admitted": 27, + "k": 3, + "operation_pairs": [ + [ + 0, + 3 + ], + [ + 2, + 2 + ], + [ + 2, + 3 + ], + [ + 2, + 4 + ], + [ + 3, + 0 + ], + [ + 3, + 2 + ], + [ + 3, + 3 + ], + [ + 3, + 4 + ], + [ + 4, + 2 + ], + [ + 4, + 3 + ] + ], + "schedules": 6561 + }, + { + "admitted": 81, + "k": 4, + "operation_pairs": [ + [ + 1, + 3 + ], + [ + 1, + 5 + ], + [ + 2, + 4 + ], + [ + 2, + 5 + ], + [ + 3, + 2 + ], + [ + 3, + 3 + ], + [ + 3, + 4 + ], + [ + 4, + 0 + ], + [ + 4, + 2 + ], + [ + 4, + 3 + ], + [ + 4, + 4 + ], + [ + 4, + 5 + ], + [ + 5, + 2 + ], + [ + 5, + 3 + ], + [ + 5, + 5 + ] + ], + "schedules": 59049 + } + ], + "price_comparisons": 100, + "scaled_price_checks": 150 + }, + "controls": [ + "missing_source_uncopy", + "forward_instead_of_inverse_batch", + "missing_dirty_cancellation_pass", + "omitted_output_three_cycle", + "omitted_workspace_exit", + "missing_cycle_ADD", + "non_equivariant_reader_rejected", + "unchecked_non_equivariance_changes_map", + "premature_canonical_observer", + "nonlinear_dirty_echo" + ], + "depth_three": { + "False": { + "direct_add": 3204, + "inverse_after_forward_peak": 106, + "inverse_arbitrary_input_l1_peak": 80, + "invoice": { + "add": 7860, + "address_travel": 141338, + "descriptor_fields": 31440, + "dispatch": 7860, + "neg": 0, + "reads": 15720, + "writes": 7860 + }, + "prefix_l1_peak": 106, + "registers": 27, + "triple_rotations": 776 + }, + "True": { + "direct_add": 3204, + "inverse_after_forward_peak": 65, + "inverse_arbitrary_input_l1_peak": 57, + "invoice": { + "add": 9408, + "address_travel": 137726, + "descriptor_fields": 37632, + "dispatch": 9408, + "neg": 0, + "reads": 18816, + "writes": 9408 + }, + "prefix_l1_peak": 65, + "registers": 27, + "triple_rotations": 1034 + } + }, + "fixture": { + "children": 5, + "eager": { + "direct_add": 228, + "inverse_after_forward_peak": 31, + "inverse_arbitrary_input_l1_peak": 28, + "invoice": { + "add": 588, + "address_travel": 7286, + "descriptor_fields": 2352, + "dispatch": 588, + "neg": 0, + "reads": 1176, + "writes": 588 + }, + "prefix_l1_peak": 31, + "registers": 21, + "triple_rotations": 60 + }, + "m": 3, + "n": 1, + "optimized": { + "direct_add": 228, + "inverse_after_forward_peak": 42, + "inverse_arbitrary_input_l1_peak": 40, + "invoice": { + "add": 504, + "address_travel": 7234, + "descriptor_fields": 2016, + "dispatch": 504, + "neg": 0, + "reads": 1008, + "writes": 504 + }, + "prefix_l1_peak": 42, + "registers": 21, + "triple_rotations": 46 + }, + "plan": [ + 8, + [ + [ + 0, + 0 + ], + [ + 0, + 1 + ], + [ + 0, + 1 + ], + [ + 0, + 1 + ], + [ + 0, + 1 + ], + [ + 1, + 2 + ] + ] + ] + }, + "kappa": "unchanged", + "predecessor_notes": 3, + "recursive_coverage": { + "basis_columns": 3744, + "cases": 192, + "primitive_instructions": 157704 + }, + "recursive_coverage_sha256": "1618215230f56d99f85c6a71ff2bffc546aedccae6e892c87c41a1fc7d54ca25", + "seed": 56, + "status": "PASS_CYCLIC_OUTPUT_RESTORATION" +} diff --git a/research/cyclic-output-restoration/CLAIM.md b/research/cyclic-output-restoration/CLAIM.md new file mode 100644 index 0000000000..90a790938f --- /dev/null +++ b/research/cyclic-output-restoration/CLAIM.md @@ -0,0 +1,39 @@ +# Local sprint claim — recursive interfaces, seed 56 + +Claim recorded 2026-10-13T21:28:50Z; expected finish 22:04:30Z. +Exact base: `dadfea6e8a78ff6ba901705f87532a71c6f5bbb8`. +OS assignment seed: **56**. Scope: cyclic-output-restoration/order-three/fixed-readers. + +Three candidates were considered: + +1. Nonzero-reader restoration coalescing: covered by PR1199, PR1203 and PR1205. +2. Higher-arity dirty connectors: PR1164, PR1185 and PR1215 already cover close alphabets. +3. **Selected:** replace paid workspace three-cycles by output three-cycles for fixed readers with `R P = Q R`. Unlike sign drift (PR1227), non-scalar drift imposes a substantive admission condition. Verify that gate and solve the complete-register boundary problem, then include both echo passes and recursive children. + +Method/domain: exact integer block-circulant readers, `N=3m`, `d=3n`; +all nine reduced boundary choices per gap through four children; +all 19,683 ternary 3x3 reader matrices for admission; exact emitted forward/inverse maps and priced recurrence over bounded trees. The seed selects `m=2+56%5=3`, `n=1`, `k=4+56%5=5` and deterministic matrix coefficients. No broad circuit or selected-supplier search. + +Optimistic complete boundary bill at the fixture: eager 30 SWAPs per batch, +shortest order-three frame path 16 SWAPs. Both echo passes are required, +so at most 28 SWAPs saved with all readers and source copy/uncopy unchanged. +The source permutation inside every child remains charged. Fail if literal +all-dirty-state replay or full pricing negates that saving. + +Expected artifact: one scoped research construction, written interface proof, +exact deterministic certificate, separately represented boundary/admission +checks, scalar/tape invoices, negative controls and reproducible package. +No selected kappa change or physical supplier admission is proposed. + +Coordination: no pinned sprint issue exists (live GraphQL check). Per the +user's fallback, the claim is local. Complete overlap snapshot at +21:27 UTC covered 859 open PRs and 24 discussion records including comments; +queries for cyclic restoration/output rotation/equivariant/intertwiner/ +permutation frame had only unrelated PR508/325 hits. Read discussion1163, +1166,1167 and relevant current claims. This is bounded overlap evidence, +not a proof of novelty. Relevant PR1227/1203/1205 full descriptions were read; +PR1227's complete README was read. No delegated workers. + +Predecessors: Sagar Thakrar PR1227 and PR1199, Aaron Wang/Navinor PR1155, +mightyOil/Philipp PR1203, Adam Gall PR1205, Ross Richardson/CubeJerry PR889. +Prepared by Ross Richardson with substantial OpenAI Codex assistance. diff --git a/research/cyclic-output-restoration/FIXTURE.json b/research/cyclic-output-restoration/FIXTURE.json new file mode 100644 index 0000000000..b9448a119a --- /dev/null +++ b/research/cyclic-output-restoration/FIXTURE.json @@ -0,0 +1,189 @@ +{ + "children": [ + { + "matrix": [ + [ + 1, + 0, + -1, + 1, + 0, + 1, + 1, + 1, + 0 + ], + [ + -1, + 1, + 0, + 1, + 1, + 0, + 0, + 1, + 1 + ], + [ + 0, + -1, + 1, + 0, + 1, + 1, + 1, + 0, + 1 + ] + ] + }, + { + "matrix": [ + [ + -1, + 0, + -1, + 1, + 0, + -1, + 1, + 1, + 0 + ], + [ + -1, + -1, + 0, + -1, + 1, + 0, + 0, + 1, + 1 + ], + [ + 0, + -1, + -1, + 0, + -1, + 1, + 1, + 0, + 1 + ] + ] + }, + { + "matrix": [ + [ + -1, + 1, + -1, + -1, + 1, + -1, + 1, + 0, + -1 + ], + [ + -1, + -1, + 1, + -1, + -1, + 1, + -1, + 1, + 0 + ], + [ + 1, + -1, + -1, + 1, + -1, + -1, + 0, + -1, + 1 + ] + ] + }, + { + "matrix": [ + [ + 1, + -1, + -1, + 0, + -1, + -1, + -1, + -1, + 1 + ], + [ + -1, + 1, + -1, + -1, + 0, + -1, + 1, + -1, + -1 + ], + [ + -1, + -1, + 1, + -1, + -1, + 0, + -1, + 1, + -1 + ] + ] + }, + { + "matrix": [ + [ + 1, + 0, + -1, + -1, + 0, + 1, + -1, + -1, + 1 + ], + [ + -1, + 1, + 0, + 1, + -1, + 0, + 1, + -1, + -1 + ], + [ + 0, + -1, + 1, + 0, + 1, + -1, + -1, + 1, + -1 + ] + ] + } + ] +} diff --git a/research/cyclic-output-restoration/PREDECESSORS.json b/research/cyclic-output-restoration/PREDECESSORS.json new file mode 100644 index 0000000000..cb58aaa74e --- /dev/null +++ b/research/cyclic-output-restoration/PREDECESSORS.json @@ -0,0 +1,29 @@ +[ + { + "pr": 1227, + "commit": "fea44a4d0d78570021d854881d15d9efe62e1713", + "path": "research/output-sign-restoration-seed51/README.md", + "local": "sources/PR1227-README.md", + "git_blob": "ade3f00abbc5e4c8f933b81bd9c07d38180781d5", + "sha256": "1a038312c647b33cb697cd78bd5b2f74f5fbb8d87ec39894176c0f6ce90f5026", + "usage": "predecessor statement and attribution; executable code not imported" + }, + { + "pr": 1203, + "commit": "38459854fd5bb93099871a84324413bd0e338d8e", + "path": "research/invariant-reader-restoration/README.md", + "local": "sources/PR1203-README.md", + "git_blob": "b884fdff7672cacd8cc9014b75d4b3e1d6c7f606", + "sha256": "039206964404ab6e6a57fca7aa55057796263c0e5cb102d9e2990b38685f7ad1", + "usage": "predecessor statement and attribution; executable code not imported" + }, + { + "pr": 1145, + "commit": "fd4d5ffc448361297e717aa30eafed578caf8e61", + "path": "research/complex-scratch-free-boundaries/README.md", + "local": "sources/PR1145-README.md", + "git_blob": "6729cffc92c73e8a26dc0214306551f243694574", + "sha256": "156ceabba27c57a29a4df24d70efd7fd0ae83a706f6d32c475ef5b2ffe8aaad8", + "usage": "existing six-ADD three-cycle upper bound and attribution; no imported executable code or lower-bound replay" + } +] diff --git a/research/cyclic-output-restoration/README.md b/research/cyclic-output-restoration/README.md new file mode 100644 index 0000000000..d92b50720e --- /dev/null +++ b/research/cyclic-output-restoration/README.md @@ -0,0 +1,268 @@ +# Three-cycle output frames replace workspace restorations + +This **recursive-interface research construction** extends the paid output-frame +idea of Sagar Thakrar's [PR1227](https://github.com/CrocSwap/integer-mult-bounds/pull/1227) +from scalar sign drift to a non-scalar three-cycle. The extension needs a real +admission condition: `R P = Q R`. Arbitrary readers do not satisfy it. + +For the frozen five-child example (`N=9` workspace coordinates, `d=3` output +coordinates), the complete source-only dirty echo costs **504 signed ADD +instructions instead of 588**. Both words restore every arbitrary scratch input. +A shortest boundary planner, full emitted recursive words and exact failure +controls make the result checkable. No selected supplier or new κ is claimed. + +## Fixed child contract and changed restriction + +Let `P` cyclically permute each of `m` workspace triples and `Q` each of `n` +output triples, sending `(a,b,c)` to `(c,a,b)`. Put `N=3m`, `d=3n`. The fixed, +indivisible child contract is + +``` +C_i(D,W) = (D + R_i W, P W), R_i P = Q R_i. +``` + +Children preserve their arbitrary private scratch and expose their literal +inverse at the same signed ADD count. Unlike sign-drifting children, these calls +are **not involutions**. Source/coefficient access and the internal source +permutation are part of the child bill. All maps here are exact and linear. + +For this particular `P,Q`, admission is equivalent to every 3×3 block of `R_i` +being circulant. Thus readers may inspect changing workspace coordinates; +they need not be invariant readers. The compiler checks the equality before +emitting a word. A separate dense multiplication check agrees on all 19,683 +3×3 matrices with entries in `{-1,0,1}`: exactly 27 are admitted. This is a +finite admission census, not a claim that only those integer readers exist. + +The parent may apply only complete-register `P^u` and `Q^v`, `u,v∈{0,1,2}`, +in gaps around the fixed ordered children. Each nontrivial power uses one +six-ADD rotation per triple. The existing six-primitive upper bound is credited +to [PR1145](https://github.com/CrocSwap/integer-mult-bounds/pull/1145); no new +rotation-circuit or minimality claim is made here. For power two, emit + +``` +a += b; b -= a; a += b; b += c; c -= b; b += c. +``` + +This sends `(a,b,c)` to `(b,c,a)`. Power one is its literal inverse. Neither +power uses a NEG, extra register, free frame annotation or unpriced temporary. +The executable checks these exact words; PR1145's lower-bound census is not +replayed or needed. Both eager and optimized batches use this same cheaper +rotation backend. + +The restriction to indivisible children is essential. The demonstration leaves +expose their terminal permutations, so a compiler allowed to remove those +permutations and sum their matrices directly beats both wrappers. This result +is an exact interface construction, not an optimal matrix algorithm. No actual +supplier with this indivisible boundary has been identified. + +## A sharp uniform boundary recurrence + +Write `A=m`, `B=n` for workspace/output costs in triple rotations; each costs six ADDs. +Let `p,q∈Z/3Z` be their respective current phases. A uniform correct word must +have `p=q` immediately before each child: after normalization of the output, +that child's contribution is `Q^(p-q) R_i W`. Independently varying `R_i` +among admitted readers includes an identity block in any block position, so a +nonzero phase cannot give the intended contribution for all readers. Arbitrary +incoming output also forces total output phase zero. This argument concerns a +word uniform over that reader class, not an accidentally cancelling fixed tuple. + +Calling a child takes aligned phase `t` to `(p,q)=(t+1,t)`. A gap returning to +aligned phase `s` therefore has the unique powers + +``` +u = s-t-1 mod 3, v = s-t mod 3, +c(t,s) = A [u != 0] + B [v != 0]. +``` + +Entrance phases cost `F_0(t)=(A+B)[t!=0]`. For each of `k` children, use + +``` +F_(j+1)(s) = min_t (F_j(t) + c(t,s)); b(k,A,B) = F_k(0). +``` + +This is an exact three-state shortest-path recurrence, with predecessor paths +retained by `model.plan`. It includes entrance and exit corrections. All gap +operations commute between the two disjoint registers; within one register +they reduce modulo three. Repeated powers cannot be cheaper than their reduced +representative at these positive symmetric prices. Thus every admissible +uniform word has such a path, and every path is realized. Induction proves the +recurrence for **all positive k,m,n**; the finite census below is a separate +implementation check, not its proof. Checkpoints requiring canonical registers +would additionally force phase zero at those cuts and are not optimized here. + +For the seed fixture, `b(5,3,1)=8`, versus the eager `5*3=15`. Its word calls +child one directly, rotates output by `Q` before each remaining child, then +applies `P` to workspace and `Q²` to output at exit. Four output rotations cost +4 triple rotations; final workspace/output corrections cost 3+1. Both +registers return to the canonical frame, with `D` increased by `(sum_i R_i)W`. + +This is distinct from PR1227's parity formula: a two-child boundary already +admits a three-operation alternative (`A+2B`), and child inversion cannot be +replaced by a forward call. The non-scalar admission and order-three boundary +planner are the added evidence. The output-frame idea and dirty-echo method +remain predecessor credit. + +## Complete echo and recursive implementation + +Let the completed batch be `H(D,W)=(D+L W,W)`, where `L=sum_i R_i`. Execute + +``` +W += X; H(D,W); W -= X; H^-1(D,W). +``` + +It returns `(D+L X, X, W_initial)` for every initial dirty `W,D`. Both copies +and both sets of complete child calls are paid. `H^-1` is the actual reverse +instruction word, with every ADD sign reversed; no involution shortcut is used. +All active ancestors' outputs and sources remain outside descendant scratch. +Siblings reuse a block only after the complete child returns. + +A leaf emits its signed matrix ADDs and `P` on its source. An internal reader +emits the above echo using its children and then applies `P` to its own source. +Sums of admitted readers remain admitted, so this recursively satisfies the +same child contract. One width-N dirty block per active internal level suffices; +no initialization or hidden clean accumulator is used. + +Let `a_v,c_v` count direct ADDs and triple rotations, respectively, **including all +descendants**. With fixed common dimensions, the complete recurrence is + +``` +leaf: a_v = sum of absolute matrix entries; c_v = m +internal: a_v = 2 sum_i a_i + 2N + c_v = 2 sum_i c_i + 2 b(k_v,m,n) + m +``` + +For a root echo omit the final `+m`. Eager restoration replaces `b` by `m k_v`. +After expansion, `ADD=a_v+6c_v`, `NEG=0`. At maximum depth `h` (leaf depth 0), +data storage is `d+(h+1)N`, counting output, source and all dirty work blocks. +This is a complete depth recurrence, not an asymptotic input-size recurrence. +With inclusive addressed-machine ADD price `alpha`, the reader bill is + +`T_v = 2 sum_i T_i + [2N + 6(2b+m)] alpha`. + +Preparation, descriptor access and routing are separate resources, not free +recursive work. The supplied compiler materializes `P_len=ADD` primitives +from description size `M`. Its planner stores complete path tuples, giving +`O(k²)` preparation time and `O(k)` live path space per distinct child count +(cached afterward). A conservative uncached whole-tree bound is +`O((h+1)(M+P_len) + sum_v k_v²)` preparation time and +`O(M+P_len+sum_v k_v+h)` compiler/program storage. This cost is additional to +the execution recurrence; no total preparation-plus-execution improvement is +claimed. The finite word must then be read. The source matrix entries and +signed operands appear in that word; no runtime multiplication or coefficient oracle is assumed for ±1 leaves. + +| Complete seed echo | Eager | Output frames | +| --- | ---: | ---: | +| Direct ADDs | 228 | 228 | +| Triple rotations, including child source drift | 60 | 46 | +| Expanded signed ADDs | 588 | 504 | +| NEGs | 0 | 0 | +| Dispatches / writes | 588 | 504 | +| Data reads | 1176 | 1008 | +| Instruction fields | 2352 | 2016 | +| Declared data-address travel | 7286 | 7234 | +| Data registers | 21 | 21 | +| Exact forward prefix row-L1 peak | 31 | 42 | +| Exact inverse prefix row-L1 peak, arbitrary inverse input | 28 | 40 | + +ADD reads two cells and writes one; records contain four fields, including +the sign and addresses. Thus reads=`2ADD`, writes=dispatches=`ADD`, +fields=`4ADD`. `oracle.invoice` independently reconstructs the access +records. The travel column visits each ADD's source then destination and +returns a cursor to zero. It is an exact score for this specified layout/access +trace, **not a constructed tape-machine implementation**. + +Arithmetic savings need not improve every resource. The depth-three witness +saves 1,548 primitives (9,408→7,860), but its travel score rises +137,726→141,338 and its prefix bound rises 65→106. Even the small fixture's +prefix bound rises 31→42. These costs must not be hidden in supplier adoption. +For this finite exact word, input magnitude ≤M gives coordinate magnitude +≤`prefix_l1_peak*M`; finite bit-width or rational representation costs are not +incorporated into a multiplication bound. No fixed-precision/rounded-leaf +contract, physical routing, hosting, common-label, all-size or analytic result +is established. + +## Reproduction and completed coverage + +Standard library only; from the repository root: + +```sh +python3.12 scripts/research_package.py --package research/cyclic-output-restoration +``` + +Expected final marker: `PASS_REGISTERED_RESEARCH_PACKAGE` with outcome completed. +The direct checker is `python3 -I -O -B research/cyclic-output-restoration/verify.py`; +its marker reports `saved_rotations=14 saved_primitives=84 no_new_kappa`. +`--emit` regenerates the complete certificate, which ordinary replay compares +field for field. Required checks use explicit exceptions and still run with `-O`. + +Completed domains, with stopping rule **exhaust exactly these finite sets**: + +- All 66,420 normalized boundary schedules through four children, including + all entrance and exit choices. The code-disjoint oracle propagates a distinct + symbolic response for each child through literal output rotations, without + using the planner's alignment predicate. The 120 admitted schedules give the + same minima at all 100 `1<=m,n<=5` price comparisons. Another 150 checks test + price scaling and the eager upper bound through 30 children; these are not + exhaustive schedule censuses at those lengths. +- All 19,683 ternary 3×3 readers, using indexed admission and independent dense + matrix products; 27 admitted, 19,656 rejected. +- `1<=m<=3`, `1<=n<=2`, `1<=k<=4`, depths 1 and 2, echo/reader contracts and + eager/optimized words: 192 cases, 3,744 basis columns and 157,704 forward + primitive occurrences. Every case checks all arbitrary dirty-state columns, + literal inverse (also from arbitrary inverse input against a separate block + inverse formula), macro expansion, recurrence, access invoice and a rational + dirty probe. A frozen five-child fixture and a separate depth-three witness + are also fully checked. Leaf entries come from `random.Random(56)` over + `{-1,0,1}`; the depth-three example uses seed 57. +- Ten mathematical controls reject missing copies/restoration/output frames, + incorrect rotation expansion, a forward-for-inverse substitution, non-equivariant + readers, premature canonical observations and nonlinear dirty substitution. + `test_package.py` adds API input, plan-path, relocation and corruption checks. + +No finite replay is a formal proof of the complete multiplication theorem. +Neither human peer review nor hosted CI success is inferred from local passes. +The selected supplier is unchanged, so its expensive cold replay was not run. + +## Provenance and credit + +Exact base: `dadfea6e8a78ff6ba901705f87532a71c6f5bbb8`; OS assignment seed **56**, +recursive interfaces. The selected construction is Rohan Arun's PR1094 on +Jeremy Kothe's retained word/packing and the PR589/555 bit lineage, with +κ=`836330098538459/500000000000000000`. The actual selected construction, review, +source manifest and certificate were inspected and pinned as historical context +in `SOURCES.json`. `upstream/`, the selected record and frozen packages are unchanged. + +Sagar Thakrar's PR1227 (`fea44a4d0d78570021d854881d15d9efe62e1713`) supplies the +paid output-sign mechanism and complete echo comparison. MightyOil/Philipp's +PR1203 (`38459854fd5bb93099871a84324413bd0e338d8e`) supplies noncommuting invariant +readers and source-only restoration accounting. Ross Richardson's PR1145 +(`fd4d5ffc448361297e717aa30eafed578caf8e61`) supplies the existing six-ADD three-cycle upper bound, found in the final overlap check and +used for both words. Its CK/JP8 lower bounds and PR1216's restored-donor extension +concern different boundary alphabets; neither is re-established here. These +three README files, original notices, Git blob IDs and SHA256 hashes are retained in `sources/` and +`PREDECESSORS.json`; no executable predecessor code is imported. Also credit +Aaron Wang/Navinor PR1155, Sagar Thakrar PR1199, Adam Gall PR1205, and Ross +Richardson/CubeJerry PR889 for the existing restoration and dirty-echo lineages. +This package does not claim priority for their compatible-reader corrections, +observation distinctions or output-frame/echo principles. + +Prepared by **Ross Richardson** with substantial **OpenAI Codex assistance** in +algebra, implementation, verification and prose, including both code paths. +No independent human audit is claimed. New material is Apache-2.0 under the +repository license; retained sources keep their original credit and notices. +The scoped claim, three considered candidates and overlap coverage are in +`CLAIM.md`; structured outcome and next questions are in `TASK.json`. + +## Open next questions + +Does a supported supplier expose an indivisible cyclic-equivariant reader with +a cheaper output action than workspace restoration? Test one candidate's exact +source-return map for `R P=Q R`, then price its routing, precision and retained +child boundary. Those missing supplier facts currently block an asymptotic +application. If its source drift can simply be deleted inside the child, reject +it as evidence for this wrapper's algorithmic benefit. + +Can canonical intermediate checkpoints retain enough of this saving? A first +step is to constrain phase zero at a specified cut in the same three-state +recurrence, then emit and price that word. This would address observation +requirements; no adaptive observer implementation is supplied here. diff --git a/research/cyclic-output-restoration/SOURCES.json b/research/cyclic-output-restoration/SOURCES.json new file mode 100644 index 0000000000..e7aafac81c --- /dev/null +++ b/research/cyclic-output-restoration/SOURCES.json @@ -0,0 +1,42 @@ +{ + "schema_version": 1, + "base_commit": "dadfea6e8a78ff6ba901705f87532a71c6f5bbb8", + "files": [ + { + "path": "certificates/selected-result.json", + "usage": "provenance", + "git_blob": "ae6a99f28aa468649eb66a361e764d769363bf11", + "sha256": "10b9e340fd8e354a37a0c4813c90e5de1dd42044b5f6aca4a3fc5a42b685fa32" + }, + { + "path": "docs/research/agent-task-catalog.json", + "usage": "provenance", + "git_blob": "c05fafaa25ba95b2d5af86b1800427198e3d20eb", + "sha256": "89b5928bc92c81e2647b6d702a7ad85a6795b8f44e2eb267b2ff3145d8f2b2ce" + }, + { + "path": "docs/research/community-batch1099-review.md", + "usage": "provenance", + "git_blob": "6cb6ec061a071a06a2d18cd4dc3e9a2b05d28099", + "sha256": "7e76d2c38e5fce30587835b7251df1430488ae4dd372611ef69a3f03f476b6cb" + }, + { + "path": "research/community-frontier1094-audit/SELECTED-SOURCE.json", + "usage": "provenance", + "git_blob": "6a75493790b4eff9c4a98051ef8b01d6aad0d5a8", + "sha256": "79b3de5db3dbcb9829789ba58e9e45758926031e2a7d80667a08429d369be53b" + }, + { + "path": "research/community-frontier1094-audit/ASSEMBLY.json", + "usage": "provenance", + "git_blob": "5fd676df060f3b450782fdf5ff5f6beb63a5eeb0", + "sha256": "1122cb3a575f8c788345fc1bf4c108ac7c3250fb81a5988671f5eb04b3ab3045" + }, + { + "path": "research/complex-t16-rare-pattern-exchanges/README.md", + "usage": "provenance", + "git_blob": "f205b7132243aedcb2aa85110a44f0c8cd1e4fe1", + "sha256": "da542711a6a3eb01ce1ebdf8f28a748e6195512687f61d003b95ac5ff281a7b2" + } + ] +} diff --git a/research/cyclic-output-restoration/TASK.json b/research/cyclic-output-restoration/TASK.json new file mode 100644 index 0000000000..cb9c006aea --- /dev/null +++ b/research/cyclic-output-restoration/TASK.json @@ -0,0 +1,69 @@ +{ + "schema_version": 1, + "task_id": "persistent-boundary", + "priority_revision": 2, + "base_commit": "dadfea6e8a78ff6ba901705f87532a71c6f5bbb8", + "original_card": { + "id": "persistent-boundary", + "question": "Can a specified pair of consecutive calls eliminate a restoration that the next call reconstructs?", + "starting_points": [ + "research/heterogeneous-owner-assembly/README.md", + "certificates/selected-result.json" + ], + "methods": [ + "Write typed entry/exit contracts and a contracting multitype recurrence.", + "Derive a lower bound for the compulsory transitions of one proposed typed interface." + ], + "acceptance_gate": "Show actual eliminated work and legal composition; changing a scalar recurrence into a matrix is insufficient.", + "first_step": { + "command": [ + "python3", + "-B", + "scripts/research_baseline.py" + ], + "expected": "PASS_RESEARCH_BASELINE_BINDINGS_ONLY", + "inspect": "Find a concrete consecutive-call boundary in the selected review and list its entry/exit obligations.", + "scope": "Positive control / source-bound orientation only; this is not a new construction or full cold replay." + }, + "first_experiment": "Specify two call types and one operation actually removed by composition; derive the normalized recurrence.", + "bottleneck_link": "Eliminating compulsory boundary work can lower recursive cost beyond packing gains.", + "allowed_variations": [ + "A two-type pilot or one explicit deferred restoration." + ], + "scope_change_triggers": [ + "Rewriting the old scalar recurrence as a matrix without eliminating work." + ], + "overlap_terms": [ + "persistent boundary", + "deferred restoration", + "multitype" + ] + }, + "scope_status": "refined", + "actual_scope": "Exact three-cycle output-frame restoration for fixed cyclic-equivariant readers, with a shortest boundary planner and complete recursively emitted dirty echo.", + "scope_change_reason": "Refine the assigned recursive-interface track to a non-scalar workspace drift. Existing PR1227 covers signs; PR1199/1203/1205 cover invariant or cancelling readers. Here readers may observe changing coordinates but must intertwine fixed order-three permutations.", + "bottleneck_link": "A conditional boundary mechanism removes paid workspace rotations between fixed child calls. This is an interface result, not an identified selected-supplier replacement or a new kappa.", + "budget_minutes": 40, + "stop_rule": "Finish all declared order-three boundary schedules through four children, all 3x3 ternary admission matrices, and bounded recursive maps; reject if the full source-only echo has no priced saving. Begin final verification by 21:54 UTC.", + "outcome": "completed", + "evidence": "CERTIFICATE.json records the full boundary/admission census, recursive maps and invoices; README.md gives the general shortest-path proof; test_package.py exercises rejection and portability.", + "author": "Ross Richardson", + "ai_assistance": "Substantial OpenAI Codex assistance in algebra, implementation, verification and prose; no independent human review claimed.", + "open_questions": [ + { + "question": "Does a supported supplier have an indivisible cyclic-equivariant child with a cheaper output action than workspace restoration?", + "why_it_matters": "Only an admitted supplier can turn this interface saving into a recursive moment change.", + "first_step": "Trace one candidate source-return map and test R P = Q R, then price routing, precision and the exact child boundary.", + "blocked_by": "No such supplier is identified here; exposed removable drift invalidates any algorithmic optimality claim." + }, + { + "question": "Can required canonical checkpoints preserve useful savings?", + "why_it_matters": "A caller may observe intermediate results while the output is in a cyclic frame.", + "first_step": "Constrain phase zero at one specified cut in the same recurrence, then emit and price its word.", + "blocked_by": "The present contract permits observation only at complete batch or echo boundaries." + } + ], + "assignment_seed": 56, + "seed_source": "OS randomness via secrets.randbelow(100), drawn once at session start", + "pricing_refinement": "Final overlap review identified PR1145 six-ADD three-cycle. Applied that same backend to both words before final verification; complete signed ADD count is 588 to 504, saving 84. Original two-SWAP pricing was a valid but nonminimal upper bound." +} diff --git a/research/cyclic-output-restoration/VALIDATION.md b/research/cyclic-output-restoration/VALIDATION.md new file mode 100644 index 0000000000..c3d5b93f06 --- /dev/null +++ b/research/cyclic-output-restoration/VALIDATION.md @@ -0,0 +1,44 @@ +# Local verification and handoff + +Research/submission base: `dadfea6e8a78ff6ba901705f87532a71c6f5bbb8`. +Environment: macOS arm64; CPython 3.12.12 (registered runner), 3.14.6 and 3.9.6. +Final mathematical implementation and certificate verified on 2026-10-13 UTC. + +- Registered Python 3.12 replay passes: complete boundary and reader census, + all recursive maps, literal inverses, both invoices, source pins, ten + mathematical controls and seven package test groups. +- The final code also passes the seven test groups on Python 3.12 and 3.9, + including isolated optimized replay, exact certificate regeneration and + five on-disk corruptions. The final direct Python 3.9 replay passes. +- Python 3.14 optimized certificate export is byte-identical to the committed + JSON. Both forward and arbitrary-input inverse matrices are checked against + independently constructed block formulas. +- Complete finite coverage: 66,420 boundary schedules (120 admitted), 100 price + comparisons; 19,683 ternary admission matrices (27 admitted); 192 recursive + cases, 3,744 basis columns and 157,704 forward primitive occurrences. The + frozen five-child and depth-three witnesses are additional complete cases. + The general optimal-boundary argument is written in README, not inferred + from those finite counts. +- Full final echo: eager 588 signed ADDs, output-frame word 504; 21 registers + in both. Complete boundary cost 15→8 triple rotations per batch, with both + passes charged. Existing six-ADD rotations from the PR1145 line are used + in both schedules; the initial two-SWAP upper price is not used in the result. +- Final marker: `PASS_CYCLIC_OUTPUT_RESTORATION schedules=66420 admission=27/19683 cases=192 saved_rotations=14 saved_primitives=84 no_new_kappa`. +- Source hashes: three retained predecessor notes authenticate by both Git + blob ID and SHA256. Six historical base-context pins pass the registered + metadata checker. Selected record verification and all five + `test_selected_result.py` tests pass; selected evidence is unchanged. +- Whitespace checks pass. Only this scoped package is added; no global + regeneration, upstream changes or frontier edits. + +The input tests exposed a Boolean/integer memoization-key collision during +implementation; the planner now uses a type-sensitive cache and rejects +Boolean prices/counts even after the integer key has been populated. This +changed no admitted positive-integer certificate result. + +The deep witness raises address travel and intermediate coefficient bounds; +the small witness also raises its coefficient bound. Full compiler/admission, +precision/rounding, tape/hosting and analytic transfer are not established. +No full selected cold replay, formal proof-assistant compilation, independent +human review or hosted CI pass is claimed. CI status is separate from these +local checks. There is no new kappa or total runtime claim. diff --git a/research/cyclic-output-restoration/VERIFY.json b/research/cyclic-output-restoration/VERIFY.json new file mode 100644 index 0000000000..00d003ba11 --- /dev/null +++ b/research/cyclic-output-restoration/VERIFY.json @@ -0,0 +1,31 @@ +{ + "schema_version": 1, + "status": "ready", + "python": "3.12", + "requirements": [], + "inputs": [], + "commands": [ + { + "argv": [ + "{python}", + "-I", + "-O", + "-B", + "{package}/verify.py" + ], + "timeout_seconds": 120, + "checks": "Complete cyclic boundary/admission census, all dirty columns, literal inverses, recursive/access invoices, source pins and mathematical negative controls." + }, + { + "argv": [ + "{python}", + "-I", + "-O", + "-B", + "{package}/test_package.py" + ], + "timeout_seconds": 240, + "checks": "Input and phase-path checks; macro expansion; noninvolution and scope controls; offline relocation, exact regeneration and five on-disk corruptions." + } + ] +} diff --git a/research/cyclic-output-restoration/model.py b/research/cyclic-output-restoration/model.py new file mode 100644 index 0000000000..7e3a1cfac4 --- /dev/null +++ b/research/cyclic-output-restoration/model.py @@ -0,0 +1,153 @@ +"""Order-three fixed-reader interface. Ross Richardson / OpenAI Codex, Apache-2.0.""" +from functools import lru_cache + + +def require(condition, message): + if not condition: + raise ValueError(message) + + +def dimensions(matrix): + require(isinstance(matrix, list) and bool(matrix), 'nonempty matrix required') + n, m = len(matrix), len(matrix[0]) + require(n % 3 == m % 3 == 0 and m > 0, 'dimensions must be positive multiples of three') + require(all(len(row) == m for row in matrix), 'ragged matrix') + require(all(type(x) is int for row in matrix for x in row), 'exact integer entries required') + return m // 3, n // 3 + + +def admitted(matrix): + """RP=QR, with P,Q sending (a,b,c) to (c,a,b) on every block.""" + m, n = dimensions(matrix) + return all(matrix[r][3*(c//3)+(c+1)%3] == matrix[3*(r//3)+(r-1)%3][c] + for r in range(3*n) for c in range(3*m)) + + +@lru_cache(None, typed=True) +def plan(k, workspace_cost, output_cost): + """Minimum cost in the complete-register P^u,Q^v boundary alphabet.""" + require(type(k) is int and k >= 1, 'positive child count required') + require(type(workspace_cost) is int and workspace_cost > 0, 'positive workspace price required') + require(type(output_cost) is int and output_cost > 0, 'positive output price required') + states = {t: ((workspace_cost + output_cost)*(t != 0), ((t, t),)) for t in range(3)} + for i in range(k): + following = {} + for s in ([0] if i == k-1 else range(3)): + candidates = [] + for t, (cost, gaps) in states.items(): + u, v = (s-t-1) % 3, (s-t) % 3 + candidates.append((cost+workspace_cost*(u != 0)+output_cost*(v != 0), gaps+((u, v),))) + following[s] = min(candidates) + states = following + return states[0] + + +def rotate(start, blocks, power): + require(power in (0, 1, 2), 'invalid cyclic power') + word = [] + if power: + for b in range(blocks): + word.append(('R', start+3*b, power)) + return word + + +def inverse(word): + return [(('A', op[1], op[2], -op[3]) if op[0] == 'A' + else ('R', op[1], (-op[2]) % 3)) for op in reversed(word)] + + +def matrix_of(node): + if 'matrix' in node: + r = node['matrix'] + require(admitted(r), 'reader does not intertwine the cyclic actions') + return [row[:] for row in r] + require(set(node) == {'children'} and bool(node['children']), 'nonempty child list required') + matrices = [matrix_of(c) for c in node['children']] + require(all(dimensions(r) == dimensions(matrices[0]) for r in matrices), 'child dimension mismatch') + return [[sum(r[i][j] for r in matrices) for j in range(len(matrices[0][0]))] for i in range(len(matrices[0]))] + + +def depth(node): + return 0 if 'matrix' in node else 1+max(map(depth, node['children'])) + + +def reader(node, source, output, free, m, n, eager=False): + if 'matrix' in node: + word = [] + for i, row in enumerate(node['matrix']): + for j, value in enumerate(row): + word.extend([('A', output+i, source+j, 1 if value > 0 else -1)]*abs(value)) + else: + word = echo(node['children'], source, output, free, m, n, eager) + return word + rotate(source, m, 1) + + +def batch(children, source, output, free, m, n, eager=False): + gaps = ((0, 0),)+((2, 0),)*len(children) if eager else plan(len(children), m, n)[1] + word = [] + for i, (u, v) in enumerate(gaps): + word += rotate(source, m, u)+rotate(output, n, v) + if i < len(children): + word += reader(children[i], source, output, free, m, n, eager) + return word + + +def echo(children, source, output, free, m, n, eager=False): + b = batch(children, free, output, free+3*m, m, n, eager) + copy = [('A', free+i, source+i, 1) for i in range(3*m)] + return copy+b+inverse(copy)+inverse(b) + + +def compile_word(node, contract='echo', eager=False): + r = matrix_of(node) + m, n = dimensions(r) + require(contract in ('echo', 'reader'), 'invalid contract') + require(contract == 'reader' or 'children' in node, 'echo needs children') + args = (3*n, 0, 3*n+3*m, m, n, eager) + word = reader(node, *args) if contract == 'reader' else echo(node['children'], *args) + return word, 3*n+(depth(node)+1)*3*m + + +def expand(word): + """Six signed ADDs per triple rotation, with no extra register or NEG. + + The power-two circuit is two adjacent signed swaps; its literal inverse + is power one. Credit the prior six-primitive upper bound in PR1145. + """ + result = [] + for op in word: + if op[0] == 'R': + _, a, power = op + b, c = a+1, a+2 + cycle = [('A', a, b, 1), ('A', b, a, -1), ('A', a, b, 1), + ('A', b, c, 1), ('A', c, b, -1), ('A', b, c, 1)] + result += cycle if power == 2 else inverse(cycle) + else: + result.append(op) + return result + + +def recurrence(node, contract='echo', eager=False): + r = matrix_of(node) + m, n = dimensions(r) + if 'matrix' in node: + require(contract == 'reader', 'leaf requires reader contract') + return sum(abs(x) for row in r for x in row), m + child = [recurrence(c, 'reader', eager) for c in node['children']] + b = len(child)*m if eager else plan(len(child), m, n)[0] + return 2*sum(a for a, s in child)+6*m, 2*sum(s for a, s in child)+2*b+(m if contract == 'reader' else 0) + + +def invoice(word): + a = sum(op[0] == 'A' for op in word) + g = sum(op[0] == 'N' for op in word) + require(a+g == len(word), 'invoice expects expanded ADD/NEG word') + position = travel = 0 + for op in word: + visits = (op[2], op[1]) if op[0] == 'A' else (op[1],) + for address in visits: + travel += abs(address-position) + position = address + travel += position # canonical cursor return + return dict(add=a, neg=g, dispatch=a+g, reads=2*a+g, writes=a+g, + descriptor_fields=4*a+2*g, address_travel=travel) diff --git a/research/cyclic-output-restoration/oracle.py b/research/cyclic-output-restoration/oracle.py new file mode 100644 index 0000000000..86cde254dc --- /dev/null +++ b/research/cyclic-output-restoration/oracle.py @@ -0,0 +1,150 @@ +"""Separate literal-phase enumeration and dense arithmetic oracle; Apache-2.0. +Ross Richardson with substantial OpenAI Codex assistance. This does not import model.py. +""" +from itertools import product + + +def boundary_census(k): + """All nine normalized choices in every gap, with separate reader symbols. + + Every previous response receives actual output rotations. No alignment + predicate or shortest-path recurrence is used to admit a schedule. + """ + admitted, prices = 0, set() + for digits in product(range(9), repeat=k+1): + workspace = original_output = 0 + responses = [] + work_operations = output_operations = 0 + for i, digit in enumerate(digits): + u, v = divmod(digit, 3) + workspace = (workspace+u) % 3 + original_output = (original_output+v) % 3 + responses = [(phase+v) % 3 for phase in responses] + work_operations += u != 0 + output_operations += v != 0 + if i < k: + responses.append(workspace) + workspace = (workspace+1) % 3 + if workspace == original_output == 0 and not any(responses): + admitted += 1 + prices.add((work_operations, output_operations)) + return dict(k=k, schedules=9**(k+1), admitted=admitted, + operation_pairs=[list(p) for p in sorted(prices)]) + + +def identity(n): + return [[int(i == j) for j in range(n)] for i in range(n)] + + +def multiply(a, b): + return [[sum(x*y for x, y in zip(row, col)) for col in zip(*b)] for row in a] + + +def permutation(blocks): + p = [[0]*(3*blocks) for _ in range(3*blocks)] + for i in range(3*blocks): + p[i][3*(i//3)+(i-1)%3] = 1 + return p + + +def literal_admission(r): + return multiply(r, permutation(len(r[0])//3)) == multiply(permutation(len(r)//3), r) + + +def declared_matrix(node): + if 'matrix' in node: + return node['matrix'] + rs = [declared_matrix(c) for c in node['children']] + return [[sum(a) for a in zip(*rows)] for rows in zip(*rs)] + + +def expected(node, registers, contract): + r = declared_matrix(node) + n, m = len(r), len(r[0]) + result = identity(registers) + for i in range(n): + result[i][n:n+m] = r[i][:] + if contract == 'reader': + for i in range(m): + result[n+i] = [0]*registers + result[n+i][n+3*(i//3)+(i-1)%3] = 1 + return result + + +def expected_inverse(node, registers, contract): + r = declared_matrix(node) + n, m = len(r), len(r[0]) + result = identity(registers) + # Invert the triangular block matrix directly, independently of word reversal. + pinv = multiply(permutation(m//3), permutation(m//3)) + response = multiply(r, pinv) if contract == 'reader' else r + for i in range(n): + result[i][n:n+m] = [-x for x in response[i]] + if contract == 'reader': + for i in range(m): + result[n+i] = [0]*registers + result[n+i][n:n+m] = pinv[i] + return result + + +def replay(word, registers, initial=None): + state = identity(registers) if initial is None else [row[:] for row in initial] + peak = max(sum(abs(x) for x in row) for row in state) + for instruction in word: + if instruction[0] == 'A': + _, dest, src, sign = instruction + state[dest] = [a+sign*b for a, b in zip(state[dest], state[src])] + elif instruction[0] == 'N': + dest = instruction[1] + state[dest] = [-x for x in state[dest]] + elif instruction[0] == 'R': + _, a, power = instruction + rows = state[a:a+3] + state[a:a+3] = rows[-power:]+rows[:-power] + dest = a + else: + raise ValueError('unknown instruction') + peak = max(peak, sum(abs(x) for x in state[dest])) + return state, peak + + +def vector_replay(word, data): + result = data[:] + for op in word: + if op[0] == 'A': + result[op[1]] += op[3]*result[op[2]] + elif op[0] == 'N': + result[op[1]] *= -1 + elif op[0] == 'R': + _, a, power = op + rows = result[a:a+3] + result[a:a+3] = rows[-power:]+rows[:-power] + else: + raise ValueError('unknown instruction') + return result + + +def invoice(word): + """Reconstruct field/data-access records rather than use algebraic counts.""" + reads = writes = fields = steps = travel = cursor = 0 + adds = negations = 0 + for op in word: + addresses = [] + if op[0] == 'A': + adds += 1 + addresses = [(op[2], 'read'), (op[1], 'read'), (op[1], 'write')] + elif op[0] == 'N': + negations += 1 + addresses = [(op[1], 'read'), (op[1], 'write')] + else: + raise ValueError('expanded instructions required') + for address, action in addresses: + travel += abs(cursor-address) + cursor = address + reads += action == 'read' + writes += action == 'write' + fields += len(op) + steps += 1 + travel += cursor + return dict(add=adds, neg=negations, dispatch=steps, reads=reads, writes=writes, + descriptor_fields=fields, address_travel=travel) diff --git a/research/cyclic-output-restoration/sources/PR1145-README.md b/research/cyclic-output-restoration/sources/PR1145-README.md new file mode 100644 index 0000000000..6729cffc92 --- /dev/null +++ b/research/cyclic-output-restoration/sources/PR1145-README.md @@ -0,0 +1,101 @@ +# Exact scratch/work obstruction for historical complex boundaries + +**Scoped negative result; no new kappa.** The five moved registers at a +historical CK/JP8 2+3-cycle boundary cannot implement that permutation in eight +or fewer PR696 real primitives without a temporary register. The existing +PR971 circuit uses eight with one temporary register. Unlike the concurrent +PR1095 monomial-prefix audit, this exclusion allows arbitrary mixed dyadic +intermediate rows and unbounded coefficient magnitudes. + +| Permutation | With scratch, existing witness | Without scratch, proved range | +|---|---:|---:| +| two-cycle | 4 | 4 exactly | +| three-cycle | 5 | 6 exactly | +| disjoint two- and three-cycle | 8 | 9–10 | + +The precise restriction is **exactly the moved coordinates**: no fixed register +may be borrowed. Each circuit must implement its permutation for arbitrary +incoming values. Both qualifications matter; this is not a general claim +that temporary registers cannot be eliminated from the supplier. + +The complete source census finds 28 two-cycles and 14 two-plus-three-cycles in +each of four CK/JP8 orientation programs, 168 boundaries in total. Under this +interface the boundary invoice increases from 224 to at least 238 primitives +per real component, or **at least 28 additional real primitives per complete +orientation**. Exact witnesses give an upper bound of 252 per component. +Other operations still use coefficient work; no whole-supplier scratch saving +or changed paid recursive profile follows. + +## Reproduce + +Python 3.9+ and a C++17 compiler; standard libraries only, no network or Git: + +```sh +python3 -I -O -B research/complex-scratch-free-boundaries/verify.py +``` + +Expected final line: + +```text +PASS_COMPLEX_SCRATCH_FREE_BOUNDARIES boundaries=168 states=509157 costs=4,6,>=9 scratch_costs=4,5,8 no_new_kappa +``` + +The command rebuilds all three radius-four balls modulo three and independently +compiles a C++ implementation. Every state and minimum distance must match +exactly. It then checks the full meet-in-the-middle result, literal rational +witnesses, 37 gate omissions, all source pins and the complete source census. +It compares the entire fresh receipt against EXPECTED.json and writes nothing. +`CXX` can select a C++17 compiler. A missing compiler or failed independent +check is an error, never a skipped pass. + +```sh +python3 -I -O -B research/complex-scratch-free-boundaries/test_package.py +``` + +Additional tests cover an independent dense GL(2,3) oracle, all ordered +two-dimensional matrix products, quotient halving, generator/depth omissions, +modular false positives, wrong signs and boundary barriers, every source +corruption, complete receipt corruption, and an isolated minimal offline +relocation. See [VALIDATION.md](VALIDATION.md) for executed checks and limits. + +[PROOF.md](PROOF.md) gives the rank argument excluding destructive operations, +the dyadic reduction, completeness of the radius-four intersection test and +the precise scope. [EXPECTED.json](EXPECTED.json) contains all actual boundary +indices and exact witnesses. The search has no timeout or heuristic pruning; +the five-coordinate question at length nine remains open here. + +## Provenance, coordination and credit + +Exact research base: `ba82555c64e1879e4b7decce28186f208fcb8262`. +The selected result at that base is PR1042, conditional +`kappa = 1672188119205421/10^18`. Its actual construction, assembly and review +were followed; this contribution deliberately concerns historical PR626 +boundaries. [SOURCES.json](SOURCES.json) pins seven replay inputs by SHA256 +and Git blob, plus five base-context documents separately. No pending PR code +is imported. Input archive hashes bind immutable source containers; this +package does not regenerate those archives. + +The submission refresh is `ce7ad1b6ab09452c3478723a2e96ed5ff212dc08`, where +upstream now selects PR1094, kappa `0.001672660197076918`. All seven historical +inputs are unchanged. This package edits neither selected record. + +[CLAIM.md](CLAIM.md) records OS seed 24, three candidates, overlap checks, +bounded domain and stopping rule. There was no pinned coordination issue. +PR1118 covers CK grid synthesis and PR1116 restored helper butterflies; both +were excluded from task selection. PR1095 provides the adjacent one-scratch, +monomial-prefix lower bound. This contribution changes both premises: no +scratch and arbitrary mixed rows. A different seed alone is not the novelty. + +Credit **ToikY / Eva Ayala (PR971)** for the deferred-swap construction, +boundary inventory and existing 4/8-primitive witnesses; **woklerx (PR1095)** +for the adjacent scoped lower-bound question; **Sagar Thakrar (PR696)** for +the primitive lowering; **Chafik Boukhalfa (PR626)** and **Jeremy Kothe (PR622)** +for the historical words and interfaces; and icekylinx, DreamingOfClouds, +eumemic, Rohan Arun and the retained source lineage. No priority claim is made +for elementary permutation identities, modular group bounds or BFS. + +Prepared for **Ross Richardson / @RossRichardson**, with substantial +**OpenAI Codex assistance**, including the separately implemented checker. +Apache-2.0; repository notices and upstream sources remain unchanged. No +independent human review, full theorem proof, new kappa or measured +multiplication speedup is claimed. diff --git a/research/cyclic-output-restoration/sources/PR1203-README.md b/research/cyclic-output-restoration/sources/PR1203-README.md new file mode 100644 index 0000000000..b884fdff76 --- /dev/null +++ b/research/cyclic-output-restoration/sources/PR1203-README.md @@ -0,0 +1,315 @@ +# Reader-compatible restoration deferral + +**Research note / exact recursive interface; no new kappa.** Nonzero reads of +borrowed workspace need not prevent deferring its restoration. The precise +condition is that each read annihilates the accumulated drift. A fully expanded +example, including cancellation of incoming dirt and both source calls, reduces +**210 to 150 two-address ADD instructions**, and **5,864 to 4,504 data-tape word +transitions**, for the same fixed borrowing interface. Preparation and control +costs are separately and explicitly charged below; these counts are not a +runtime benchmark or an optimal circuit claim. + +This refines Navinor's [PR1155](https://github.com/CrocSwap/integer-mult-bounds/pull/1155) +at `9821c6e9388f3fc097e94b72be9fa7b41a849527`. Its retained +[original note](sources/PR1155-README.md) states that read-freedom is necessary +and sufficient and uses one failing reader as evidence of necessity. That +counterexample shows that **some** readers fail, not that **every** reader fails. +The construction here has compatible readers after actual nonidentity drift. +PR1155's shared-final-target observability also admits a weaker cancellation +condition, distinguished below. No assertion is made about its executable +fixtures beyond the statement inspected in that pinned note. + +Concurrent [PR1199](https://github.com/CrocSwap/integer-mult-bounds/pull/1199) +by Sagar Thakrar at `85ac2880ea5bda44f28632b71ffa2b4e35ec6b7d` independently +corrects the same necessity claim, supplies a diagonal-sign checkpoint planner, +and states the general summed-defect identity. **No priority is claimed for +that correction or the prefix-defect identity.** This package adds separate +noncommuting-permutation evidence, distinct-output admission, an explicitly +dirt-independent shared-B wrapper, and a separately implemented symbolic +scalar/tape invoice. It does not reproduce or supersede PR1199's cut planner. +The exact concurrent source was inspected at the final submission check; +its results are credited, not silently treated as our discovery. + +## Reproduce + +Python 3.10+, standard library only, from the repository root: + +```sh +python3 -I -O -B research/invariant-reader-restoration/verify.py +``` + +Expected: + +```text +PASS_INVARIANT_READER_RESTORATION cases=5832 wrapped_adds=210->150 no_new_kappa +``` + +The command verifies retained source hashes, recomputes every certificate field, +and compares against [CERTIFICATE.json](CERTIFICATE.json). Required checks use +explicit exceptions and remain active with `-O`. The companion command +`python3 -I -O -B research/invariant-reader-restoration/test_package.py` checks +relocation, deterministic export and deliberate on-disk corruptions. Neither +command regenerates selected or upstream artifacts. `--write PATH` is explicitly +an authoring/export mode, not acceptance against the committed certificate. + +## Exact typed interface and proof + +Work over the rationals, with all arithmetic exact. Let `z` be arbitrary borrowed +workspace, `y_i` distinct arbitrary output accumulators, and `G_i` fixed invertible +linear workspace maps. A child first performs `y_i += H_i z`, then `z <- G_i z`. +All coefficients are immutable; no output aliases workspace or another output. +Readers are target-independent, and private scratch and tape positions used by +complete child operations are restored. The code specializes `G_i` to permutations +and `H_i` to rows with coefficients in `{-1,0,1}`. + +The eager contract follows each child with `G_i^-1`. The deferred contract +omits these restorations and applies `(G_r ... G_1)^-1` once at batch exit. Put +`P_0 = I`, `P_j = G_j ... G_1`. Then: + +- Eager output `i` is `y_i^0 + H_i z_0`. +- Deferred output `i` is `y_i^0 + H_i P_(i-1) z_0`. +- Both final workspaces are `z_0`. + +Consequently, equality for **all incoming dirty states** is equivalent to + +```text +H_i (P_(i-1) - I) = 0 for every i. (1) +``` + +Sufficiency follows by subtraction. For necessity, a nonzero defect matrix has +a nonzero column; the corresponding standard basis workspace is a counterexample. +This is an all-size algebraic proof, not an inference from the finite census. +For permutation prefixes, each reader row must be constant on each cycle of +that prefix. It need not be invariant under every individual `G_j`, and it need +not vanish. The condition concerns the actual chronological prefix. + +**One shared output at batch exit.** If all readers update the same accumulator, +only their summed defect must vanish: + +```text +sum_i H_i (P_(i-1) - I) = 0. (2) +``` + +For `G_1 = swap(0,1)`, `G_2 = G_3 = I`, and readers `0,e_0,e_1`, the individual +defects are `0,(-1,1),(1,-1)`. Condition (2) holds while (1) fails. If the shared +output is observable after every child, equality of consecutive partial sums +again forces each individual defect to vanish. Thus observability is a material +part of the contract; no general "one reader breaks it" theorem follows. + +## Returning arbitrary dirty workspace without exposing it + +Reading preserved input state is not by itself a catalytic scratch contract: +outputs must be independent of borrowed dirt. Supply a read-only source `x` +and a complete, exact additive call `B: z += Bx`, independent of the old target. +Its inverse is `z -= Bx`; both restore private scratch. Execute: + +1. Pre-read `y_i -= H_i z` for every output. +2. Call `B` to obtain `z_1 = z_0 + Bx`. +3. Execute either compatible reader/permutation batch above. +4. Call the complete inverse `B` after batch restoration. + +The output is `y_i^0 - H_i z_0 + H_i(z_0+Bx) = y_i^0 + H_i Bx`, and final +workspace is exactly `z_0`. Source `x` is unchanged. All `x,z,y_i` ports are +pairwise disjoint and excluded from private child scratch. The routing temporary +and source accumulator are **two admitted clean scalars**, separately charged; +no clean workspace row is assumed. Readers of other live state, nonlinear or +rounded B calls, data-dependent permutations and intermediate observation during +the pre-read/load sandwich are outside this contract. + +The same proof holds for rows of any common length `L`, with `G_i` replaced by +`G_i tensor I_L` and the corresponding block readers. It does not construct a +selected supplier or discharge the repository's physical recursive interfaces. + +## Noncommuting eight-coordinate fixture + +Use old-coordinate-to-new-coordinate cycle notation: + +```text +G_1 = (01)(23)(45)(67) +G_2 = (0123)(4567) +G_3 = (04)(15)(26)(37) +H_1 = e_0, H_2 = e_0 + e_1, H_3 = e_0 + e_2. +``` + +The first two maps do not commute. `P_2 = (02)(46)` and +`P_3 = (06)(15)(24)(37)`. Each reader satisfies (1); the latter two read +workspace that has actually drifted. Both have nonzero dependence on the +original workspace. The catalytic wrapper uses +`(Bx)_j = x_j + x_((j+1) mod 8)`; B need not be invertible or commute with G. +The certificate spells out gather permutations `new[j] = old[p[j]]`, avoiding +ambiguity between cycle and index-array conventions. + +The matrix checker uses dense exact products. The separately implemented +[backend](backend.py) instead composes index arrays, decomposes cycles, emits +scalar instructions and literally loads/unloads its clean accumulator. On every +basis of the 19 arbitrary source/workspace/output coordinates (plus a mixed +case), both complete wrapper programs implement `y_i += H_i Bx`, preserve all +source/workspace coordinates, restore the temporary, and have a working literal +reverse-inverse. This is finite evidence for the actual emitted fixture; the +universal identity is proved above. + +## Complete invoice and recurrence + +A two-address ADD `d += sign*s`, with distinct ports, expands as +`A += memory[s]; memory[d] += sign*A; A -= memory[s]`. Its source is unchanged, +so A returns to zero. It pays two source reads, one target read, one target +write and three scalar additions/subtractions. The data head traverses +`0 -> s -> d -> s -> 0`, paying `2*s + 2*abs(d-s)` word transitions. The scalar +A is separately located in a fixed arithmetic workspace; arithmetic/read/write +macro costs include their internal access and scratch restoration. + +Each permutation cycle is implemented by swaps. A swap uses an initially zero +scalar T and these **six**, fully charged, distinct-port shears: + +```text +T += a; a -= T; a += b; b -= a; b += T; T -= b. +``` + +It returns `(a,b,T)` as `(b,a,0)`. A k-cycle uses `k-1` swaps. Here the forwards +use 14 swaps, eager inverses another 14, and the composed inverse four. There +is no free array copy, hidden permutation, erased scratch or unpaid inverse. +The full wrapper has two 16-ADD B calls and ten reader ADDs. + +| Complete wrapper charge | Eager | Deferred | +|---|---:|---:| +| Forward-permutation ADDs | 84 | 84 | +| Restoration ADDs | 84 | 24 | +| Both B calls | 32 | 32 | +| Pre-reads and batch reads | 10 | 10 | +| **Two-address ADD instructions** | **210** | **150** | +| Scalar additions/subtractions | 630 | 450 | +| Source reads | 420 | 300 | +| Target reads / target writes | 210 / 210 | 150 / 150 | +| Data-tape word transitions | 5,864 | 4,504 | + +Workspace addresses are 0..7, outputs 8..10, T is 11, and immutable source +addresses are 12..19. A is outside that data tape. The instruction stream has +one fixed-width `(opcode,d,s,sign)` record per ADD; both programs use the same +address width. Each event reads one record and returns the data head. Thus +instruction reads, control dispatch and address decoding must be paid 210 and +150 times, respectively, at the same declared per-record cost. No instruction +or coefficient-access cost is claimed to be zero. + +For integer scalar inputs of magnitude less than `2^p`, every workspace value during the +wrapper has magnitude at most `3*2^p`; during swaps it is either one of these +values or zero. An intermediate output is bounded by `9*2^p`, and A loads only +workspace, source or T. Signed width `b = p+5` therefore suffices without +rounding. Allocation includes 20 data words and A, plus instruction storage, +address/control counters and the scratch required by the chosen exact scalar +arithmetic backend. This bound is about this fixture, not a floating-point +precision contract or a fixed-tape multiplication implementation. + +For event-count `K`, scalar-add count `S`, word travel `J`, and word width b, +a complete parametrized online bill is + +```text +W(program;b) = S*c_add(b) + 3K*c_read(b) + K*c_write(b) + + b*J*c_move + K*c_dispatch(b, address_width). +``` + +Here read/write costs include intra-word scans and return to a word boundary; +`c_add` includes arithmetic scratch restoration and scalar register updates; +`c_dispatch` includes instruction-record access, decoding and counter work. +No backend numerical timings are inferred. Online saving for the fixture is +`180*c_add + 180*c_read + 60*c_write + 1360*b*c_move + 60*c_dispatch`. +Startup allocation/zeroing of the two clean scalars is paid in admission `I`. + +For a general node, let `C_B^+/-` be complete recursive source-call costs, +`R_H^-/+` complete reader costs, `Q(G)` complete routing costs, `P_S` program and +coefficient preparation, and `D_S` dispatch/control not already included. With +no double counting of these terms, the recurrences are + +```text +T_E = I + P_E + C_B^+ + C_B^- + R_H^- + R_H^+ + + sum_i [Q(G_i) + Q(G_i^-1)] + D_E, +T_D = I + P_D + C_B^+ + C_B^- + R_H^- + R_H^+ + + sum_i Q(G_i) + Q(P_r^-1) + D_D. +``` + +If `C_B^sign(L) = sum_j C_child(j,sign)(L_j) + A_B^sign(L)`, substitute the +**entire** recurrence in both occurrences. All children, coefficient and source +access, frame conversions, copies, private restoration and tape return belong +in those terms. No child is eliminated by this argument. A caller requiring a +new frame or external layout conversion must add it; this fixture stays in one +fixed coordinate layout. Recursive children may not borrow the live rows. + +Preparation is not free: composing explicit n-entry permutation descriptors +uses `r*n` index lookups and stores (24 of each here), plus validation, inverse +construction, cycle extraction and instruction emission. General descriptors +are not composable in merely `O(r)` work. Budget `O(r*n*log(n+1))` bit work for +index manipulation, in addition to validation/coefficient preparation and +writing the full instruction stream. The implementation computes the product +in both modes to return admission metadata; a lean eager implementation could +omit those 24 updates. We do not use this avoidable baseline work as a saving. +For `M` invocations of a prepared fixed program, pay `I + P_S + M*W_S`. +For a single call, the extra preparation must be smaller than the displayed +online saving before claiming a total speedup. Neither M nor that tradeoff is +silently assumed. The full parametrized bill makes this boundary explicit. + +Directly computing `H_i Bx` can be cheaper than either wrapper in this toy +fixture. This is a legal replacement and correction within a fixed borrowing +interface, **not** a minimum over arbitrary circuits, a claim that a new +supplier is profitable, or a way to increase kappa from operation counts. + +## Coverage, failures and limits + +A further [separate symbolic checker](independent_check.py), included in the +one-command replay, does not import the matrix criterion or backend execution +engine. It checks all 873 permutations of widths 1 through 6 against the emitted +forward words, then reconstructs both full wrapper maps using integer coefficient +vectors. It independently derives every invoice field and bounds all intermediate +coefficient L1 norms: workspace/T/A at most 3, outputs at most 5, source at most 1. +The conservative integer-width allowance above is therefore sufficient. Its +symbolic-map digest and exact bounds are retained in the certificate. + +The finite census exhausts all `2^3 * 9^3 = 5,832` three-child instances with +2-coordinate permutations and reader coefficients in `{-1,0,1}`. Independent +literal state replay on both workspace basis vectors agrees with the matrix +criteria in every case. There are 2,592 compatible distinct-output instances, +2,772 compatible shared-final-output instances, and 180 cancellation-only cases. +This is completed finite coverage, not a new impossibility theorem. + +Controls include an incompatible nonzero reader with an explicit basis witness; +a zero-workspace input that hides that defect; omitted final restoration; +incorrect inverse order on a noncommuting example; an omitted reader; missing +catalytic pre-reads that expose dirt; an omitted inverse B that fails restoration; +and invalid/aliased instruction ports. Certificate/package mutations test +rejection of an unpaid operation, source corruption and receipt corruption. + +The exact general lemma is proved in prose. Neither the finite replay nor the +second Codex agent's algebraic review is independent human review or a formal +proof in a proof assistant. No selected cold replay was run: this isolated note +changes no supplier, selected certificate, shared generator, upstream source, +review ledger or frozen predecessor evidence. All-size compiler, common-label / +mutable-source realization, hosting, precision/tape and analytic transfer +obligations of the selected multiplication result remain open as recorded there. + +## Provenance and credit + +Base: `1b59b624d21924f8e3537cdc1ac52d3be6eda2fe`. Assignment seed **50**, generated +from OS randomness, selects recursive interfaces and the three-child/eight-entry +fixture. There is no random search. [CLAIM.md](CLAIM.md) records the three narrow +candidates and overlap decision; [SOURCE-PINS.json](SOURCE-PINS.json) identifies +exact context files and retained sources. The selected result at that base is +`836330098538459/500000000000000000`, from #1094 on #1087; complex binds in that +assembly. We do not reassign its binding supplier or modify its frontier. + +Credit Navinor / Aaron Wang with opencode assistance for PR1155's deferral +proposal and motivating reader question. Credit Sagar Thakrar's concurrent #1199 for the same applicability correction +and its distinct checkpoint planner, and his #1012 and +avirazza's #974 for the distinct hosted-assembly cost question; their reported +mass-neutrality is not contradicted by this abstract-interface correction. +Ross Richardson (CubeJerry)'s #889 supplies the shared-B, multiple-output dirty +fanout/echo construction; the pre-read/load/unload wrapper here is an instance +of that established mechanism, not a new batching claim. The additional result +is admitting nonzero readers through intervening workspace permutations using +the exact prefix condition, independently corroborating PR1199. Gareth Davidson's #1057 and woklerx's #1164 concern dirty-pool allocation and +higher-arity echoes, not the reader-defect criterion here. Ross Richardson's +universal-connector work and the repository's preceding dirty-restoration work +retain their own scopes and attribution. No priority claim is made for elementary +linear invariance or echo cancellation. + +Prepared for **mightyOil (Philipp)** with substantial **OpenAI Codex assistance** +in mathematics, implementation, verification and writing, including three scoped +Codex subagents. New files are Apache-2.0; retained source credit is in +[NOTICE.md](NOTICE.md). diff --git a/research/cyclic-output-restoration/sources/PR1227-README.md b/research/cyclic-output-restoration/sources/PR1227-README.md new file mode 100644 index 0000000000..ade3f00abb --- /dev/null +++ b/research/cyclic-output-restoration/sources/PR1227-README.md @@ -0,0 +1,240 @@ +# Output sign frames replace large workspace restorations + +This is a recursive-interface research construction with a sharp boundary +cost in a restricted model. It does not improve the selected multiplication +exponent. With five fixed children, an eight-coordinate dirty workspace and +one output coordinate, a complete source-dependent echo uses **96 ADD + 104 +NEG**, versus **96 ADD + 160 NEG** with eager restoration. Both restore every +scratch coordinate on every input. The saving is 56 scalar negations. + +The restriction matters: child calls are indivisible. The parent may negate +either the whole output register or the whole workspace between calls. A +compiler that can remove a child's internal drift can beat both words. For +example, the explicit matrix leaves below expose their final negations; direct +evaluation of their sum is cheaper than the echo. This is an exact interface +result, not an optimized matrix algorithm or a runtime benchmark. + +## Interface and exact boundary cost + +Work over the integers, rationals or complex numbers with exact arithmetic. +Let `D` have width `d`, `W` have width `N`, and let fixed children satisfy + +``` +C_i(D,W) = (D + R_i W, -W), i = 1,...,k. +``` + +Each `R_i` is a linear map. A child's private scratch is arbitrary and restored; +its cost includes its reader, source access, source negation and private work. +The caller has both execution directions at the same declared scalar cost. +These children are involutions, but the implementation still emits the literal +reverse word for inverse calls. No sign-controllable reader is assumed. + +The desired batch is `B(D,W)=(D + (sum_i R_i)W,W)`. Eager execution restores +`W` after every child, for `kN` additional scalar NEG instructions. The parent +can instead execute these operations: + +1. Call the first child directly. +2. Before each subsequent child, negate all `d` output coordinates. +3. At exit, negate `W` if `k` is odd, or negate `D` if `k` is even. + +Before child `i`, both registers are in sign `(-1)^(i-1)` relative to the +canonical eager state. Linearity makes the child's increment have that same +sign. It then flips `W`, and the next output negation aligns the two signs +again. The final operation restores both canonical registers. This proves the +batch identity for every dimension and every tuple of linear maps, including +nonzero readers of every changing workspace coordinate. + +The additional cost of this schedule is `2 floor(k/2)d + (k mod 2)N`. +Choosing it when `d=k`. Restoration also +requires `a = k mod 2` and `b = 0 mod 2`. Minimizing `aN+bd` under these +constraints gives the displayed formula, and the two schedules attain it. +Operations in the entrance gap cannot improve this lower bound. + +Thus `d>=N` yields no saving in this model. For `d