From 30ae49d57441e9f1ffa7233f8f64729988a2fca1 Mon Sep 17 00:00:00 2001 From: Jerry Jiaheng Chen <80299683+CubeJerry@users.noreply.github.com> Date: Thu, 12 Nov 2026 10:11:39 +0800 Subject: [PATCH] Restart encoded forward and inverse CRT endpoints on one retained 79-role inventory --- research/encoded-crt-restart/EXPORT-PINS.json | 92 + research/encoded-crt-restart/OVERLAP.md | 29 + .../encoded-crt-restart/PR-DESCRIPTION.md | 72 + research/encoded-crt-restart/PR-TITLE.txt | 1 + research/encoded-crt-restart/PROOF.md | 308 ++ research/encoded-crt-restart/README.md | 145 + research/encoded-crt-restart/RESULT.json | 3212 +++++++++++++++++ research/encoded-crt-restart/REVIEW.md | 64 + research/encoded-crt-restart/SOURCES.json | 55 + research/encoded-crt-restart/TASK.json | 96 + research/encoded-crt-restart/VALIDATION.json | 46 + research/encoded-crt-restart/VERIFY.json | 46 + research/encoded-crt-restart/checks.py | 187 + .../independent/RESULT.json | 9 + .../independent/SOURCE-BINDINGS.json | 75 + .../encoded-crt-restart/independent/check.py | 75 + .../predecessor/inverse_frontend.py | 52 + .../predecessor/inverse_producer.py | 174 + .../research/crt-mixed-row-entry/bridge.py | 93 + .../crt-persistent-numerical-owner/owner.py | 77 + .../encoded-balanced-crt-endpoint/endpoint.py | 157 + .../encoded-balanced-crt-entry/frontend.py | 277 ++ .../encoded-crt-entry-lifecycle/entry.py | 117 + .../research/encoded-current-crt/producer.py | 172 + .../predecessor4025/source/records.py | 271 ++ .../predecessor4025/source/words.py | 415 +++ research/encoded-crt-restart/restart.py | 113 + research/encoded-crt-restart/verify.py | 246 ++ 28 files changed, 6676 insertions(+) create mode 100644 research/encoded-crt-restart/EXPORT-PINS.json create mode 100644 research/encoded-crt-restart/OVERLAP.md create mode 100644 research/encoded-crt-restart/PR-DESCRIPTION.md create mode 100644 research/encoded-crt-restart/PR-TITLE.txt create mode 100644 research/encoded-crt-restart/PROOF.md create mode 100644 research/encoded-crt-restart/README.md create mode 100644 research/encoded-crt-restart/RESULT.json create mode 100644 research/encoded-crt-restart/REVIEW.md create mode 100644 research/encoded-crt-restart/SOURCES.json create mode 100644 research/encoded-crt-restart/TASK.json create mode 100644 research/encoded-crt-restart/VALIDATION.json create mode 100644 research/encoded-crt-restart/VERIFY.json create mode 100644 research/encoded-crt-restart/checks.py create mode 100644 research/encoded-crt-restart/independent/RESULT.json create mode 100644 research/encoded-crt-restart/independent/SOURCE-BINDINGS.json create mode 100644 research/encoded-crt-restart/independent/check.py create mode 100644 research/encoded-crt-restart/predecessor/inverse_frontend.py create mode 100644 research/encoded-crt-restart/predecessor/inverse_producer.py create mode 100644 research/encoded-crt-restart/predecessor/source/research/crt-mixed-row-entry/bridge.py create mode 100644 research/encoded-crt-restart/predecessor/source/research/crt-persistent-numerical-owner/owner.py create mode 100644 research/encoded-crt-restart/predecessor/source/research/encoded-balanced-crt-endpoint/endpoint.py create mode 100644 research/encoded-crt-restart/predecessor/source/research/encoded-balanced-crt-entry/frontend.py create mode 100644 research/encoded-crt-restart/predecessor/source/research/encoded-crt-entry-lifecycle/entry.py create mode 100644 research/encoded-crt-restart/predecessor/source/research/encoded-current-crt/producer.py create mode 100644 research/encoded-crt-restart/predecessor/source/research/r437-preparation-composition/predecessor4025/source/records.py create mode 100644 research/encoded-crt-restart/predecessor/source/research/r437-preparation-composition/predecessor4025/source/words.py create mode 100644 research/encoded-crt-restart/restart.py create mode 100644 research/encoded-crt-restart/verify.py diff --git a/research/encoded-crt-restart/EXPORT-PINS.json b/research/encoded-crt-restart/EXPORT-PINS.json new file mode 100644 index 0000000000..bc30c73173 --- /dev/null +++ b/research/encoded-crt-restart/EXPORT-PINS.json @@ -0,0 +1,92 @@ +[ + { + "path": "research/r437-preparation-composition/predecessor4025/source/words.py", + "sha256": "5c37f57708ba3131bdcb03139f9dbc29886bee44569c09cbba51b68f75acd7f9", + "git_blob": "8d4ba37e2778acb35b34e0719df2caf138fbeb50", + "bytes": 13794, + "repository": "CrocSwap/integer-mult-bounds", + "commit": "e54523517d0f03e58352e647c403a5af3e525a57", + "local": "predecessor/source/research/r437-preparation-composition/predecessor4025/source/words.py" + }, + { + "path": "research/r437-preparation-composition/predecessor4025/source/records.py", + "sha256": "0c9c4b23e998597fb877bb1a29da69ac869b68262abe635b162b4dba9c69b372", + "git_blob": "4f00467a0ff580954ad2fd0c7380240c753ddef3", + "bytes": 9888, + "repository": "CrocSwap/integer-mult-bounds", + "commit": "e54523517d0f03e58352e647c403a5af3e525a57", + "local": "predecessor/source/research/r437-preparation-composition/predecessor4025/source/records.py" + }, + { + "path": "research/encoded-crt-entry-lifecycle/entry.py", + "sha256": "0537ec98f306270c8ff6a424841886cf53f675d9947029347090c7dc779616d7", + "git_blob": "1fa2b0cb88320d4f5b623554bb0fc6de332b773c", + "bytes": 6377, + "repository": "CrocSwap/integer-mult-bounds", + "commit": "e54523517d0f03e58352e647c403a5af3e525a57", + "local": "predecessor/source/research/encoded-crt-entry-lifecycle/entry.py" + }, + { + "path": "research/encoded-current-crt/producer.py", + "sha256": "88dab4ca02a92164a67826db361214fa1405e4b4a588f8c4279a21bcee95ab76", + "git_blob": "a327b0161eca57a1cc44ec2aa8e3defed2167ddc", + "bytes": 7891, + "repository": "CrocSwap/integer-mult-bounds", + "commit": "e54523517d0f03e58352e647c403a5af3e525a57", + "local": "predecessor/source/research/encoded-current-crt/producer.py" + }, + { + "path": "research/crt-persistent-numerical-owner/owner.py", + "sha256": "1d73f432f8de9c791260c43335eb207d82bbb3f5b190cc76d0d914a4db076f41", + "git_blob": "20ef3519b6fef691ec92b7315e320b5e8ce9bf18", + "bytes": 2980, + "repository": "CrocSwap/integer-mult-bounds", + "commit": "e54523517d0f03e58352e647c403a5af3e525a57", + "local": "predecessor/source/research/crt-persistent-numerical-owner/owner.py" + }, + { + "path": "research/crt-mixed-row-entry/bridge.py", + "sha256": "89c38638c0d66da731566c903c32e7fa1ad31088d29cfd2634fce823dd07c1f9", + "git_blob": "57f6853e262a6136bc616f1e47a31d0ace28495c", + "bytes": 3864, + "repository": "CrocSwap/integer-mult-bounds", + "commit": "e54523517d0f03e58352e647c403a5af3e525a57", + "local": "predecessor/source/research/crt-mixed-row-entry/bridge.py" + }, + { + "path": "research/encoded-balanced-crt-entry/frontend.py", + "sha256": "6ec9aab626a9d7a229b6f13ce6863e1ca77fa30ef65a4a66ae03a6ffaf2ee78c", + "git_blob": "8adbe2cfef74da9854ed0b70b6c221f5746efa9f", + "bytes": 10737, + "repository": "CubeJerry/integer-mult-bounds", + "commit": "cc35ecedce6f208d5056fab6d17c58555affc73c", + "local": "predecessor/source/research/encoded-balanced-crt-entry/frontend.py" + }, + { + "path": "research/encoded-balanced-crt-endpoint/endpoint.py", + "repository": "CubeJerry/integer-mult-bounds", + "commit": "532b60ac427f47191175aba2e1317db0f3508d51", + "sha256": "c24ae2c90d175d276120438809e7c7401b8a8c04dec139f1b7345e9778984ced", + "git_blob": "b084d893bdb2ce5571ef00196a9ec6a60e723964", + "bytes": 6038, + "local": "predecessor/source/research/encoded-balanced-crt-endpoint/endpoint.py" + }, + { + "path": "research/encoded-balanced-crt-inverse/inverse_frontend.py", + "repository": "CubeJerry/integer-mult-bounds", + "commit": "8c0e55c9ba25ff2c8199b01539a4d56ae71a1473", + "local": "predecessor/inverse_frontend.py", + "git_blob": "17abfb8500043bcdeb656094bb0213d911d986fc", + "sha256": "0e5f4c9450372c90000f5ebf3c22dfbe7241dd53da9ae9bcce310af859b009ef", + "bytes": 2167 + }, + { + "path": "research/encoded-balanced-crt-inverse/inverse_producer.py", + "repository": "CubeJerry/integer-mult-bounds", + "commit": "8c0e55c9ba25ff2c8199b01539a4d56ae71a1473", + "local": "predecessor/inverse_producer.py", + "git_blob": "46bf6ef4e2dfa53bca17ac668914b1a842eaba9e", + "sha256": "6acdebee7134fbc8e2d121060286bd05e7282900da8a28a78c80937dde7ea178", + "bytes": 8041 + } +] diff --git a/research/encoded-crt-restart/OVERLAP.md b/research/encoded-crt-restart/OVERLAP.md new file mode 100644 index 0000000000..e1d96ea354 --- /dev/null +++ b/research/encoded-crt-restart/OVERLAP.md @@ -0,0 +1,29 @@ +# Focused overlap and expansion decision + +Pinned canonical main: `e54523517d0f03e58352e647c403a5af3e525a57`. +Live PR queries on 2026-11-12: `"CRT" "reuse"`, `"CRT" "restart"`, +and `"79" "roles"`. The canonical research-tree metadata was also checked +for restart, reentry, historical-storage and owner packages. These bounded +queries are not an exhaustive novelty proof; the decisive evidence is the +exact predecessor's explicit missing interface. + +| Predecessor | Established | Distinct remaining seam | +|---|---|---| +| #5505; canonical `crt-persistent-numerical-owner/owner.py` | Stable 63-role owner and numerical call reentry | Guards, topology and source staging at the whole endpoint boundary | +| #7152, `66adbede4bd4ab603ba3e0a7f6708403905b753c` | Repeated compiled-geometry numerical/ROM state traversals on 127 roles | Different provider closure, encoded frontend and 79-role inventory | +| #7154, `cc35ecedce6f208d5056fab6d17c58555affc73c` | Encoded numerical node schedule; 78 roles in one read-only iterator | Whole-source changing-state writer and whole-call restart | +| #7351, `d2ed3959c30528b0b85fc6d815d4ad4f94f6be86` | Complete encoded forward address-state endpoint, 79 roles | Persistent restart after full topology retirement | +| #7352, `8c0e55c9ba25ff2c8199b01539a4d56ae71a1473` | Encoded reverse and fresh two-sided composition | PROOF section 5 and Open next question 2 explicitly leave same-inventory restart open and charge 158 histories | + +Decision: continue one narrowly scoped adapter. It can change the concrete +retained-inventory interface while preserving all scientific predecessors. +The optimistic budget is constant marker/ownership traffic plus the entire +old invocation bill, not a speculative new recurrence. Stop on a required +new physical role, a hidden historical-capacity scan, nonblank successful +old tails, changed numerical source, or a failure of the rolewise envelope. +No added payload, prime-selection or compact-macro implementation is bundled. + +The new theorem retains a supplied-clean-history premise at initial entry. +It does not rename arbitrary dirty acquisition as successful reentry. The +negative dirty-tail experiment is a scope control, not an impossibility +theorem about algorithms with encoded frontiers or paid cleaning passes. diff --git a/research/encoded-crt-restart/PR-DESCRIPTION.md b/research/encoded-crt-restart/PR-DESCRIPTION.md new file mode 100644 index 0000000000..292e22c24f --- /dev/null +++ b/research/encoded-crt-restart/PR-DESCRIPTION.md @@ -0,0 +1,72 @@ +## Result and why it matters + +Close the exact persistent-restart obligation in CrocSwap/integer-mult-bounds#7352. +The unchanged encoded forward and inverse address-state endpoints can run any +finite successful sequence on the same 79 physical histories. The predecessor +charged 158 histories for a fresh forward/inverse pair. Every original +invocation cost remains charged. + +For current width sums A_i, time is T_initial + sum_i O(A_i^4). With initial +private history K0 and maxima Amax,dmax, retained local backing is at most +K0 + 3 Amax dmax + 74 Amax + 23 dmax + 223, plus source and protected-prefix +histories. The proof bounds each physical role's historical maximum. + +## Exact change and novelty + +A fixed constructor facade rearms the existing eight guards, seven topology +ports and staging port, and returns the already retained 63-role numerical +bank. Ten pinned scientific files remain byte-for-byte unchanged. Initial +fresh acquisition plus validation costs 1264 raw Port actions (316 for supplied +clean inventory); each call adds exactly 80 rearm and 316 finish actions. + +Credit CrocSwap/integer-mult-bounds#5505 for numerical-bank reentry, +CrocSwap/integer-mult-bounds#7154 for encoded geometry, and +CrocSwap/integer-mult-bounds#7152 for the different compiled 127-role pipeline. +CrocSwap/integer-mult-bounds#7351 and #7352 already provide the CRT maps. +This contribution is their exact whole-call restart and repeated-history bill. + +Base: `e54523517d0f03e58352e647c403a5af3e525a57`. +Immediate exact heads: #7351 `d2ed3959c30528b0b85fc6d815d4ad4f94f6be86`; +#7352 `8c0e55c9ba25ff2c8199b01539a4d56ae71a1473`. +All runtime inputs are committed exports with Git-blob/SHA256 authentication; +replay requires neither pending Git history nor network access. + +## Verification + +```sh +python3 -I -W error -B research/encoded-crt-restart/verify.py +python3 -I -O -W error -B research/encoded-crt-restart/verify.py +``` + +Expected: `PASS_ENCODED_CRT_PERSISTENT_RESTART calls=174 nodes=270 roles=79 controls=14`. +The actual encoded run loop drives every call. A defining-congruence observer +checks current-node output, complete tails, identities, meters and costs. +New Port/Word/Arena constructors are forbidden after acquisition. The changed +geometry sequence grows, shrinks and regrows on translated origins behind +opaque prefixes. Fourteen controls target lifecycle, direction, aliasing, +hidden acquisition, historical accounting and inadmissible dirty tails. + +Separate root proof/source review and an independent modular-inverse CRT oracle +pass 32 further calls and 96 nodes. See REVIEW.md and independent/ for exact +hashes, source bindings and reproduction. Finite tests corroborate the written +induction; no formal-kernel or independent human acceptance is claimed. + +## Limits and kappa status + +**No new kappa; the selected 0.00363005817 remains conditional on all five +foundational assumptions.** Initial whole-tail blankness is explicit for +supplied inventory. Two local observations do not validate arbitrary dirty +tails; successful complete retirement establishes future entry inductively. +Linear-use calls grant no stale-handle authority and no failure rollback. + +Source acquisition/re-encoding, payload routing, exceptional-key adaptation, +binary lowering and the full outer caller remain separate paid obligations. +Open next questions and complete source-model costs are in the package. + +## Credit and assistance + +Prepared for **@CubeJerry / Jerry Chen**, with substantial **OpenAI assistance**. +Credit the exact published predecessors, JoyboyBrian's numerical/owner work, +Ali Romman's source interface, Cinna Davis's balanced CRT, Hiroki KUMAZAKI, +ToikY, commdata2338 and all retained notices. Separate AI review does not imply +independent human or formal-kernel acceptance. No selected or frozen file changes. diff --git a/research/encoded-crt-restart/PR-TITLE.txt b/research/encoded-crt-restart/PR-TITLE.txt new file mode 100644 index 0000000000..bde98c01ae --- /dev/null +++ b/research/encoded-crt-restart/PR-TITLE.txt @@ -0,0 +1 @@ +Restart the encoded forward and inverse balanced CRT endpoints on one 79-role inventory with paid reentry and retained history diff --git a/research/encoded-crt-restart/PROOF.md b/research/encoded-crt-restart/PROOF.md new file mode 100644 index 0000000000..7d880bbc53 --- /dev/null +++ b/research/encoded-crt-restart/PROOF.md @@ -0,0 +1,308 @@ +# Persistent restart of the encoded balanced CRT endpoints + +Prepared for Jerry Chen / @CubeJerry with substantial OpenAI assistance. +Apache-2.0. Canonical base: `e54523517d0f03e58352e647c403a5af3e525a57`. +This is a source-relative successful-call composition theorem. **No new kappa.** + +## 1. Claim and retained premises + +The exact forward and inverse endpoints are those of +[CrocSwap/integer-mult-bounds#7351](https://github.com/CrocSwap/integer-mult-bounds/pull/7351) +and [#7352](https://github.com/CrocSwap/integer-mult-bounds/pull/7352), at heads +`d2ed3959c30528b0b85fc6d815d4ad4f94f6be86` and +`8c0e55c9ba25ff2c8199b01539a4d56ae71a1473`. +Their algebra, current-coordinate numerical arithmetic, encoded traversal, +same-source staging/commit, and successful retirement are inherited results. +The inverse's PROOF section 5 and Open next question 2 leave same-inventory restart +open and charge 158 private histories for a fresh forward/inverse pair. + +For every call there are `d >= 2` axes, where d is a power of two. Declared +widths satisfy `h_i in {ell-1,ell}`, `ell >= 2`; moduli are pairwise coprime +and satisfy `2 <= s_i < 2^h_i`; coordinates satisfy `0 <= x_i < 2^h_i`. +These conditions force `h_i >= 2`. The #5353 padded source encoding is +already supplied on a disjoint source port at local head one. Set + +``` +A = sum_i h_i, M = 2 + 3A + 4d, P* = A+1. +``` + +The source is mutable only by its owner outside a numerical lease. Source +production, re-encoding after a geometry change, acquisition of a different +source, and any payload routing remain caller operations with their own bill. +The restart adapter does not perform or price them as zero. The theorem can +use one physical source throughout; an environment retaining several source +ports must count all those external histories separately. + +The private inventory consists of 79 disjoint roles. On initial admission +each role has its head at local one and **every cell in its complete retained +local backing is blank**, including local zero. The inventory may be freshly +acquired or have arbitrary, already paid blank historical lengths `k_r`. +Local checks of cells zero and one do not establish the whole-tail premise. +For translated origins, an opaque prefix to the left of each local zero is +separately retained, charged, and never accessed. + +**Theorem.** Under the pinned predecessor contracts and the linear-use +discipline below, `Restart` implements any finite sequence of successful +forward and inverse endpoint calls on this same 79-role inventory. Each +call takes only the supplied source and one direction bit. It derives all +geometry from the current physical source, applies the correct complete +padded address-state map, preserves all source bytes outside coordinates, +and returns all 79 complete historical backings blank at their original +local heads. No Port, numerical Word, or Arena backing is reacquired after +initial admission, and no backing or meter is reset, shortened, or replaced. + +Thus both `F^-1(F(x))=x` and `F(F^-1(x))=x` use 79 private histories on the +same admitted shape, rather than the predecessor's fresh-pair 158. Both +complete invocation costs remain charged. Calls with different legal shapes, +moduli, coordinate values, or directions may be interleaved at retired +boundaries; they are not asserted to be inverse to each other when their +mathematical maps differ. + +This does not discharge the full selected `owned_erasure`, `precision_tape`, +or `analytic_recovery` assumptions. It resolves this specific restart +implication using the inherited successful numerical and source contracts. +The selected conditional kappa remains **0.00363005817**. + +## 2. Exact fixed-role interface + +The numerical owner has 63 roles in its unchanged acquisition order: + +| Roles | Count | Use | +|---|---:|---| +| 0 | 1 | Current precision guide | +| 1–2 | 2 | Canonical left/right node input streams | +| 3–59 | 57 | Fifty-six numerical words and one template | +| 60–62 | 3 | Padded left/right inputs and whole-node output | +| 63–70 | 8 | Protected current-width numerical guards | +| 71–76 | 6 | `axis`, `depth`, `halve_a`, `halve_b`, `half`, `double` | +| 77 | 1 | Reusable source width guide | +| 78 | 1 | Full-source staged update | + +`Restart` retains the existing `Bank` object and its first 63 ports. The +unchanged owner's `open` resets only its bounded role cursor and busy flag; +its adapter obtains each current numerical role from the same port tuple. +The remaining sixteen ports are returned by a fixed constructor facade in +the order above. A facade acquisition performs exactly these five Port +actions: read local one; move to zero; read zero; write LEFT; move to one. +It does not inspect a length or assign a decoded runtime width. + +The unchanged frontend constructor immediately retires its eight guards, +keeps the seven topology markers while manufacturing the encoded shape, +and then the unchanged endpoint constructor retires its staging role. +Hence it sees exactly the logical entry state created by a fresh Port, +but on the actual existing backing and meter. The fresh numerical bank +constructor is replaced only by a factory returning the retained bank. +No numerical producer, forward/inverse frontend method, or source writer +is changed. `EXPORT-PINS.json` authenticates all ten imported files. + +The forward writer's exported bytes originate at commit `532b60a...`; its +Git blob `b084d893bdb2ce5571ef00196a9ec6a60e723964` was also checked at +the current #7351 head `d2ed395...`. The inverse frontend and subtractive +producer are exact #7352 bytes. The canonical sources and immediate +predecessor notices are retained without edits. + +The facade cursor is in the fixed set 0,…,16. Direction, ownership, and +active/retired flags have fixed finite domains. Identity/disjointness checks +are checks of the fixed physical role assignment, not an input-sized +addressing service. As in the predecessor, Python objects representing +the one current lease are an interpreter representation of fixed control; +the theorem does not compile an unbounded history of stale Python aliases. + +## 3. Restart invariant and successful induction + +Let `R` be the boundary predicate: no endpoint or numerical lease is active; +all 79 local heads are one; all 79 complete historical local backings are +blank; physical role identities and meters are unchanged; and the source is +disjoint and supplied in its admitted format. Initial admission provides R. + +Assume R before a call. The sixteen facade acquisitions change only cell +zero of their selected roles and preserve all old blank tails. Their fixed +order is exactly the predecessor constructor order. The numerical owner +remains the same retired owner and acquires its 63 roles in its already +proved order. Consequently the predecessor's complete-call theorem applies +with the new encoded source, not with a cached shape or precision. + +For one call, the source-driven forward or descending inverse frontend +manufactures shape, node starts, half sizes, and exact current precision. +The inverse startup and level hook remain unchanged. Each numerical lease +borrows the actual current source, stages a full equal-length replacement, +retires numerical/guard inputs, and only then commits the coordinate update. +The writer pays these stages at every node. At the natural end of the full +traversal, the frontend also retires all seven topology roles. + +The older-tail part requires explicit justification. Every owned stream is +contiguous within its current logical extent. Each successful consumer +erases the whole extent it used, including its current delimiters and +marker, before release. Every previously longer part of a role is blank +by the induction hypothesis. A shorter current extent therefore leaves +the old suffix blank, while a later larger extent either overwrites blank +old cells or extends into new blank backing. Guard RIGHT markers and +numeric templates are manufactured from the **new** guide; historical +root delimiters are never reused as current precision. The predecessor's +within-call argument already handles shrinkage followed by regrowth; +this argument supplies the identical premise across complete calls. + +It follows that every historical cell is blank again at complete return. +`finish` then checks the finite lifecycle flags and each role's local +marker/body/head by 316 paid Port actions and releases the endpoint reference. +It does not erase or forget capacity. Thus R holds after the call, proving +the theorem by induction over every finite successful sequence. + +**Why no old-capacity scan is omitted.** The algorithm uses the proved +successful-retirement invariant, not a supposed scan of an invisible blank +tail. An arbitrary nonblank cell behind a blank separator violates initial +admission or the no-external-mutation rule. The adapter cannot certify that +such a cell is absent by two local reads, and makes no such claim. Rescanning +all old capacity would give an additional history-dependent time term and +would not be covered by the current-call bound after a large shrink. Here +that rescan is unnecessary because successful execution establishes the +stronger invariant before every restart. The verifier includes a dirty-tail +countercontrol demonstrating this exact distinction. + +## 4. Linear use, failures, and translated origins + +The supported path is `start`, zero or more endpoint `step` calls followed by +complete `run`/natural termination, then `finish`; `Restart.run` executes the +whole path. A second start is rejected while the owner remains active. +Finish is rejected while the traversal, numerical lease, or staged source +commit remains unfinished. A failed start or numerical call does not yield +a fresh retired owner. No crash recovery, malformed-stream termination, +or rollback theorem is claimed. + +Clients must not invoke internal iterator-close hooks, change ports, retain +borrowed numerical aliases, or use old endpoint/lease objects after finish. +Finite flags do not grant arbitrary stale handles renewed access. The API +checks named misuses; it is not a capability-security scheme against a +caller mutating interpreter objects. This is the predecessor's successful +linear-use machine contract, now extended across whole calls. + +All port operations have unit local movement and fixed symbol tests. A +translation by a fixed origin for each physical role changes no local +transition. The program never moves left of local zero, because admitted +rewinds encounter their current LEFT marker. Its returned head is physical +origin plus one. Therefore arbitrary opaque left prefixes are preserved, +and their length is added to storage rather than discarded. The verifier's +shifted backing views test this translation without supplying runtime +geometry to the scientific code. Distinct views there have distinct +underlying physical backings; arbitrary aliased views are not admitted. + +## 5. Complete source time + +The source model counts Port and numerical Word reads, writes, and unit +moves, together with a fixed input-independent control refinement. It is +not a literal binary-TM instruction certificate. The source, writer, +numerical, guard, and owner bills remain those of #7351/#7352. + +Fresh initial Port acquisition and retirement cost 12 raw actions per +role: two for initial marker placement and ten for retirement. Thus all +79 roles cost 948. The wrapper's additional initial local validation +costs four actions per role, 316. Fresh initialization therefore has +**1264 raw Port actions**; admission of an already owned blank inventory +pays the **316** validation actions, with the cost of supplying that +inventory belonging to its caller. + +Every successful call has **80** facade rearm actions (16×5) and **316** +finish actions (79×4), exactly **396** additional raw actions. The old +per-call acquisition allowances are not subtracted to claim a tighter +theorem. All shape scans, copies, numerical operations, current-width +preparation, source staging/commit, cleanup and head returns stay charged. + +Let G range over the d−1 balanced nodes of a call and let +`P_G=1+sum_(i in G) h_i`. A safe inherited-plus-restart envelope is + +``` +C_R (M+2)^2 + 4096 + 396 + + sum_G [2^21(P_G+2)^4 + 2^16(P_G+2)^2 + 4096]. +``` + +`C_R` is a fixed control refinement constant. As before, the raw observed +frontend/adapter traffic is checked against `2^19(M+2)^2`; that raw value +is not represented as a certified literal binary-control constant. +The factor 2^21 safely covers either direction. The predecessor proves +the numerical sum is O(A^4), and M=O(A). Hence q successful calls have + +``` +T <= T_initial + sum_(i=1)^q O(A_i^4), +``` + +with no `q*K0` term. Since every admitted A_i≥4, the fixed 396-per-call +overhead is absorbed. Caller source acquisition, source re-encoding, +payload transport, and outer application are separate nonzero obligations. +No multiplication recurrence or new saving follows from this helper bound. + +## 6. Historical backing, counted by physical role + +For one call use the predecessor's rolewise backing bounds: + +``` +R(A,d) = + [P*+1] + + [2A+2d+2] repeated twice + + [P*+2] repeated 57 times + + [d(P*+2)+2] repeated three times + + [P*+2] repeated eight times + + [d+2] repeated six times + + [A+2, M]. +``` + +This vector has 79 entries in the table's physical order. Its sum is + +``` +D(A,d) = 3Ad + 74A + 23d + 223. +``` + +For a finite call sequence define A_max=max_i A_i and d_max=max_i d_i. +Every component of R is nondecreasing in both arguments. Because no role +is replaced or shortened, its final local backing is bounded by + +``` +max(k_r, max_i R_r(A_i,d_i)) + <= max(k_r, R_r(A_max,d_max)). +``` + +Thus total private local backing is at most + +``` +sum_r max(k_r,R_r(A_max,d_max)) <= K0 + D(A_max,d_max), +K0 = sum_r k_r. +``` + +Since d_max≤A_max/2, this is `K0+O(A_max^2)`, independent of the number +of successful calls. All opaque left prefixes and complete source backing +are added separately. The envelope uses **the sum of per-role historical +maxima**. Taking a maximum of observed total fresh footprints would be +invalid in general: capacities (9,1) and (1,9) have maximum total 10 but +their persistent roles require 18. + +As in the predecessors this is a retained backing bound. A Port may step +onto a blank cell immediately beyond its written backing; a visited-span +ledger must also include that reached cell. Adding one cell per fixed +role is a safe conservative adjustment for these admitted streams. It +does not turn the source-level theorem into a literal binary space proof. + +## 7. Verification and remaining obligations + +`verify.py` authenticates ten exports and runs 174 whole calls containing +270 actual numerical nodes. The source-driven `run()` controls every +traversal. A verifier-only defining-congruence oracle checks every node +and final result; no decoded value or schedule is passed to runtime. +The first two sequences exhaust all 32 padded pairs for (3,5) and test +eight adversarial four-axis inputs in both composition orders. The third +sequence changes 2→8→4→2→4→8→2 axes, grows/shrinks/regrows widths, changes +moduli, starts with nontrivial clean histories, and translates all origins +behind opaque prefixes. Source tails, complete private tails, current +precisions, identities, meters and complete costs are checked each time. + +The tests prohibit new Port/Word/Arena constructors after acquisition and +poison frontend geometry-decoding names. Fourteen controls address active +reentry, incomplete finish/commit, repeated finish, nonfinite direction, +source/private aliasing, short or aliased inventories, a live origin, +missing rearm, hidden fresh allocation, wrong direction, an inadmissible +hidden dirty tail, and max-of-total space undercharging. Finite controls +corroborate the induction; they do not establish universal validity by +enumeration, independent human acceptance, or a proof-kernel theorem. + +The concrete progress is a persistent source-relative endpoint boundary. +The arithmetic, encoded CRT maps and within-call ownership contracts remain +inherited. Payload routing, source acquisition, exceptional-key adaptation, +literal binary lowering and a full analytic recovery caller remain open. diff --git a/research/encoded-crt-restart/README.md b/research/encoded-crt-restart/README.md new file mode 100644 index 0000000000..04f0c18966 --- /dev/null +++ b/research/encoded-crt-restart/README.md @@ -0,0 +1,145 @@ +# Restart both encoded balanced CRT endpoints on the same 79 historical roles + +This package answers the persistent-restart question left open by +[CrocSwap/integer-mult-bounds#7352](https://github.com/CrocSwap/integer-mult-bounds/pull/7352). +The exact published forward and inverse address-state evaluators now reuse +one fixed inventory of **79 private roles across any finite successful call +sequence**, including changes of direction, shape, moduli and precision. +The predecessor's fresh forward/inverse pair retained 158 histories. Both +full invocation bills remain charged. **No new kappa.** + +## Exact result and why it matters + +The numerical owner already reuses 63 roles within a traversal. The new +`restart.py` supplies the missing whole-call boundary: it retains that owner +and rearms the existing eight guard, seven topology and one staging ports +through a fixed constructor facade. All ten imported scientific files stay +byte-for-byte unchanged, including encoded topology, both numerical +producers and the retire-before-commit source writer. Runtime receives no +decoded node list, precision, width, axis count or coordinate. + +The [proof](PROOF.md) shows that complete successful retirement leaves +every old tail blank, so a smaller next call can safely use its own current +extent. It need not scan an arbitrarily large old blank capacity. Historical +backing, physical identities, meters, caller source bytes and all head +returns are preserved. Growing again reuses blank old cells or extends the +same backing; it never replaces a role. + +Let `A_i` be the sum of declared widths in call i, `d_i` its axis count, +and `K0` the total initially supplied private local history. The complete +source-operation time is + +`T_initial + sum_i O(A_i^4)`. + +Write `Amax=max_i A_i` and `dmax=max_i d_i`. The exact rolewise envelope gives + +`private backing <= K0 + 3 Amax dmax + 74 Amax + 23 dmax + 223`. + +Since `dmax <= Amax/2`, this is `K0+O(Amax^2)`, independent of call count. +Source histories and opaque left prefixes are also retained and charged. +The proof uses the **sum of each role's historical maximum**, not a maximum +of fresh total footprints. A source-level backing bound remains distinct +from a literal binary-TM visited-space certificate. + +Fresh initial acquisition/retirement and wrapper validation cost **1264** +raw Port actions. Admission of an already owned blank inventory costs **316** +local validation actions, with its earlier acquisition paid by its caller. +Every successful restart adds exactly **80** rearm actions and **316** finish +actions. All inherited source scans, numerical work, current-width setup, +copying, staging, commits, cleanup and control refinement remain in the bill. + +## Reproduce + +Python 3.12 and the standard library, from the repository root: + +```sh +python3 -I -W error -B research/encoded-crt-restart/verify.py +python3 -I -O -W error -B research/encoded-crt-restart/verify.py +``` + +Expected: + +```text +PASS_ENCODED_CRT_PERSISTENT_RESTART calls=174 nodes=270 roles=79 controls=14 +``` + +The fixed receipt [RESULT.json](RESULT.json) records all 174 calls and 270 +actual numerical nodes. Every traversal is driven by the real encoded +`run()` method; a defining-congruence oracle observes each current source +and output without supplying a runtime value or schedule. Port, Word and +Arena constructors are sealed after initial acquisition. + +Coverage includes all 32 padded pairs for moduli (3,5), eight adversarial +four-axis tuples, both composition orders, and a changing-shape sequence +with 2→8→4→2→4→8→2 axes. The latter starts from substantial clean history, +grows/shrinks/regrows precision, and runs behind opaque translated prefixes. +Its final charged private backing is **5695**, below the rolewise envelope +**5800**, while keeping the same 79 histories. Fourteen controls detect +unfinished traversal/commit, aliasing, wrong direction, omitted rearm, +hidden acquisition and other specific failures. A dirty hidden-tail +countercontrol exposes the limit of local entry validation. + +Finite evidence corroborates the all-input induction. It is not a +formal-kernel proof or independent human acceptance. Executed replay and +independent review status are recorded in [VALIDATION.json](VALIDATION.json) +and [REVIEW.md](REVIEW.md), respectively. + +## Source, novelty and limitations + +Canonical base: `e54523517d0f03e58352e647c403a5af3e525a57`. +The exact inputs are package-local exports, authenticated by Git blob and +SHA-256 in [EXPORT-PINS.json](EXPORT-PINS.json); no pending commit needs to +be fetched to replay the package. [OVERLAP.md](OVERLAP.md) separates this +result from existing numerical ownership and within-traversal work. + +[#7351](https://github.com/CrocSwap/integer-mult-bounds/pull/7351) and #7352 +already provide the two complete encoded address-state maps. +[#7154](https://github.com/CrocSwap/integer-mult-bounds/pull/7154) already +derives geometry from the source; +[#5505](https://github.com/CrocSwap/integer-mult-bounds/pull/5505) already +provides the persistent numerical bank; +[#7152](https://github.com/CrocSwap/integer-mult-bounds/pull/7152) already +reuses a different 127-role numerical/ROM pipeline at compiled geometry. +This package does not claim any of those constructions as new. Its delta +is the actual 79-role encoded endpoint restart and its complete repeated-call +time/history contract. + +Initial **whole-tail blankness** is an explicit admission premise for a +supplied inventory. The local checks do not certify arbitrary retired +memory or clean hostile hidden dirt. Subsequent successful calls establish +the premise inductively. Clients follow a linear-use lifecycle; old leases +or endpoint handles acquire no renewed authority after retirement. Failed +calls do not supply a rollback or restart guarantee. + +Source acquisition/re-encoding, payload routing, exceptional-key adaptation, +literal binary lowering and the full outer caller remain separate work. +The five selected assumptions remain conditional and the complete selected +bound stays at **kappa=0.00363005817**. This is scoped progress on the +owned-erasure and precision interfaces, not a full foundational discharge. + +## Open next questions + +1. **Bind one actual exceptional-key caller.** Pin its admitted format and + sequence of required calls, then charge source production, changing + representation and returned keys. Reusable private history alone does + not supply the raw compact macro or payload interface. +2. **Lower the whole source closure to one binary program and tariff.** + Begin with the two fixed facade procedures, then include the inherited + arithmetic, topology, input acquisition and all control constants. The + present fixed source model does not certify that binary refinement. +3. **Admit initially dirty histories if a real caller requires them.** + A usable encoded historical frontier and paid cleaning protocol must be + specified first. Local blank observations cannot prove an unbounded + unseen suffix clean; this package deliberately does not assume otherwise. + +## Credit + +Prepared for **Jerry Chen / @CubeJerry**, with substantial **OpenAI +assistance** in reasoning, code and checks. Retain CubeJerry's encoded +forward/inverse and source-driven topology lineage; JoyboyBrian's numerical, +entry and persistent-owner contracts; Ali Romman's encoded padded source +and retired-write boundary; Cinna Davis's balanced CRT construction; +Hiroki KUMAZAKI's current-coordinate and padded-map work; ToikY's compiled +whole-tree work; commdata2338's history accounting; and every notice in the +unchanged exports. New material is Apache-2.0. No independent human or +formal-kernel acceptance is asserted. diff --git a/research/encoded-crt-restart/RESULT.json b/research/encoded-crt-restart/RESULT.json new file mode 100644 index 0000000000..bc8c6fd90e --- /dev/null +++ b/research/encoded-crt-restart/RESULT.json @@ -0,0 +1,3212 @@ +{ + "calls": 174, + "controls": [ + "restart_while_traversal_active", + "finish_before_full_traversal", + "finish_before_source_commit", + "double_finish", + "non_boolean_direction", + "source_aliases_private_role", + "incomplete_supplied_inventory", + "aliased_supplied_inventory", + "supplied_unretired_marker", + "omitted_rearm_marker", + "hidden_fresh_port_on_restart", + "wrong_inverse_provider", + "outside_contract_dirty_tail_detected_by_observer", + "max_of_totals_undercharges_distinct_role_histories" + ], + "new_kappa": null, + "nodes": 270, + "scope": "successful 79-role source-relative restart; no arbitrary dirty-tail cleanup", + "sequences": [ + { + "acquisition_actions": 1264, + "calls": [ + { + "actions": 59480, + "axes": 2, + "nodes": 1, + "output": [ + 0, + 0 + ], + "precisions": [ + 6 + ], + "private_bound": 669, + "raw_bound": 8976343436, + "retained_private": 648, + "reverse": false, + "width_sum": 5 + }, + { + "actions": 59488, + "axes": 2, + "nodes": 1, + "output": [ + 0, + 0 + ], + "precisions": [ + 6 + ], + "private_bound": 669, + "raw_bound": 8976343436, + "retained_private": 648, + "reverse": true, + "width_sum": 5 + }, + { + "actions": 59488, + "axes": 2, + "nodes": 1, + "output": [ + 0, + 0 + ], + "precisions": [ + 6 + ], + "private_bound": 669, + "raw_bound": 8976343436, + "retained_private": 648, + "reverse": true, + "width_sum": 5 + }, + { + "actions": 59480, + "axes": 2, + "nodes": 1, + "output": [ + 0, + 0 + ], + "precisions": [ + 6 + ], + "private_bound": 669, + "raw_bound": 8976343436, + "retained_private": 648, + "reverse": false, + "width_sum": 5 + }, + { + "actions": 59475, + "axes": 2, + "nodes": 1, + "output": [ + 0, + 1 + ], + "precisions": [ + 6 + ], + "private_bound": 669, + "raw_bound": 8976343436, + "retained_private": 648, + "reverse": false, + "width_sum": 5 + }, + { + "actions": 59483, + "axes": 2, + "nodes": 1, + "output": [ + 0, + 1 + ], + "precisions": [ + 6 + ], + "private_bound": 669, + "raw_bound": 8976343436, + "retained_private": 648, + "reverse": true, + "width_sum": 5 + }, + { + "actions": 59483, + "axes": 2, + "nodes": 1, + "output": [ + 0, + 1 + ], + "precisions": [ + 6 + ], + "private_bound": 669, + "raw_bound": 8976343436, + "retained_private": 648, + "reverse": true, + "width_sum": 5 + }, + { + "actions": 59475, + "axes": 2, + "nodes": 1, + "output": [ + 0, + 1 + ], + "precisions": [ + 6 + ], + "private_bound": 669, + "raw_bound": 8976343436, + "retained_private": 648, + "reverse": false, + "width_sum": 5 + }, + { + "actions": 59483, + "axes": 2, + "nodes": 1, + "output": [ + 0, + 2 + ], + "precisions": [ + 6 + ], + "private_bound": 669, + "raw_bound": 8976343436, + "retained_private": 649, + "reverse": false, + "width_sum": 5 + }, + { + "actions": 59491, + "axes": 2, + "nodes": 1, + "output": [ + 0, + 2 + ], + "precisions": [ + 6 + ], + "private_bound": 669, + "raw_bound": 8976343436, + "retained_private": 649, + "reverse": true, + "width_sum": 5 + }, + { + "actions": 59491, + "axes": 2, + "nodes": 1, + "output": [ + 0, + 2 + ], + "precisions": [ + 6 + ], + "private_bound": 669, + "raw_bound": 8976343436, + "retained_private": 649, + "reverse": true, + "width_sum": 5 + }, + { + "actions": 59483, + "axes": 2, + "nodes": 1, + "output": [ + 0, + 2 + ], + "precisions": [ + 6 + ], + "private_bound": 669, + "raw_bound": 8976343436, + "retained_private": 649, + "reverse": false, + "width_sum": 5 + }, + { + "actions": 59483, + "axes": 2, + "nodes": 1, + "output": [ + 0, + 3 + ], + "precisions": [ + 6 + ], + "private_bound": 669, + "raw_bound": 8976343436, + "retained_private": 649, + "reverse": false, + "width_sum": 5 + }, + { + "actions": 59491, + "axes": 2, + "nodes": 1, + "output": [ + 0, + 3 + ], + "precisions": [ + 6 + ], + "private_bound": 669, + "raw_bound": 8976343436, + "retained_private": 649, + "reverse": true, + "width_sum": 5 + }, + { + "actions": 59491, + "axes": 2, + "nodes": 1, + "output": [ + 0, + 3 + ], + "precisions": [ + 6 + ], + "private_bound": 669, + "raw_bound": 8976343436, + "retained_private": 649, + "reverse": true, + "width_sum": 5 + }, + { + "actions": 59483, + "axes": 2, + "nodes": 1, + "output": [ + 0, + 3 + ], + "precisions": [ + 6 + ], + "private_bound": 669, + "raw_bound": 8976343436, + "retained_private": 649, + "reverse": false, + "width_sum": 5 + }, + { + "actions": 59491, + "axes": 2, + "nodes": 1, + "output": [ + 0, + 4 + ], + "precisions": [ + 6 + ], + "private_bound": 669, + "raw_bound": 8976343436, + "retained_private": 650, + "reverse": false, + "width_sum": 5 + }, + { + "actions": 59499, + "axes": 2, + "nodes": 1, + "output": [ + 0, + 4 + ], + "precisions": [ + 6 + ], + "private_bound": 669, + "raw_bound": 8976343436, + "retained_private": 650, + "reverse": true, + "width_sum": 5 + }, + { + "actions": 59499, + "axes": 2, + "nodes": 1, + "output": [ + 0, + 4 + ], + "precisions": [ + 6 + ], + "private_bound": 669, + "raw_bound": 8976343436, + "retained_private": 650, + "reverse": true, + "width_sum": 5 + }, + { + "actions": 59491, + "axes": 2, + "nodes": 1, + "output": [ + 0, + 4 + ], + "precisions": [ + 6 + ], + "private_bound": 669, + "raw_bound": 8976343436, + "retained_private": 650, + "reverse": false, + "width_sum": 5 + }, + { + "actions": 57471, + "axes": 2, + "nodes": 1, + "output": [ + 0, + 5 + ], + "precisions": [ + 6 + ], + "private_bound": 669, + "raw_bound": 8976343436, + "retained_private": 650, + "reverse": false, + "width_sum": 5 + }, + { + "actions": 57479, + "axes": 2, + "nodes": 1, + "output": [ + 0, + 5 + ], + "precisions": [ + 6 + ], + "private_bound": 669, + "raw_bound": 8976343436, + "retained_private": 650, + "reverse": true, + "width_sum": 5 + }, + { + "actions": 57479, + "axes": 2, + "nodes": 1, + "output": [ + 0, + 5 + ], + "precisions": [ + 6 + ], + "private_bound": 669, + "raw_bound": 8976343436, + "retained_private": 650, + "reverse": true, + "width_sum": 5 + }, + { + "actions": 57471, + "axes": 2, + "nodes": 1, + "output": [ + 0, + 5 + ], + "precisions": [ + 6 + ], + "private_bound": 669, + "raw_bound": 8976343436, + "retained_private": 650, + "reverse": false, + "width_sum": 5 + }, + { + "actions": 57471, + "axes": 2, + "nodes": 1, + "output": [ + 0, + 6 + ], + "precisions": [ + 6 + ], + "private_bound": 669, + "raw_bound": 8976343436, + "retained_private": 650, + "reverse": false, + "width_sum": 5 + }, + { + "actions": 57479, + "axes": 2, + "nodes": 1, + "output": [ + 0, + 6 + ], + "precisions": [ + 6 + ], + "private_bound": 669, + "raw_bound": 8976343436, + "retained_private": 650, + "reverse": true, + "width_sum": 5 + }, + { + "actions": 57479, + "axes": 2, + "nodes": 1, + "output": [ + 0, + 6 + ], + "precisions": [ + 6 + ], + "private_bound": 669, + "raw_bound": 8976343436, + "retained_private": 650, + "reverse": true, + "width_sum": 5 + }, + { + "actions": 57471, + "axes": 2, + "nodes": 1, + "output": [ + 0, + 6 + ], + "precisions": [ + 6 + ], + "private_bound": 669, + "raw_bound": 8976343436, + "retained_private": 650, + "reverse": false, + "width_sum": 5 + }, + { + "actions": 57471, + "axes": 2, + "nodes": 1, + "output": [ + 0, + 7 + ], + "precisions": [ + 6 + ], + "private_bound": 669, + "raw_bound": 8976343436, + "retained_private": 650, + "reverse": false, + "width_sum": 5 + }, + { + "actions": 57479, + "axes": 2, + "nodes": 1, + "output": [ + 0, + 7 + ], + "precisions": [ + 6 + ], + "private_bound": 669, + "raw_bound": 8976343436, + "retained_private": 650, + "reverse": true, + "width_sum": 5 + }, + { + "actions": 57479, + "axes": 2, + "nodes": 1, + "output": [ + 0, + 7 + ], + "precisions": [ + 6 + ], + "private_bound": 669, + "raw_bound": 8976343436, + "retained_private": 650, + "reverse": true, + "width_sum": 5 + }, + { + "actions": 57471, + "axes": 2, + "nodes": 1, + "output": [ + 0, + 7 + ], + "precisions": [ + 6 + ], + "private_bound": 669, + "raw_bound": 8976343436, + "retained_private": 650, + "reverse": false, + "width_sum": 5 + }, + { + "actions": 59674, + "axes": 2, + "nodes": 1, + "output": [ + 1, + 2 + ], + "precisions": [ + 6 + ], + "private_bound": 669, + "raw_bound": 8976343436, + "retained_private": 650, + "reverse": false, + "width_sum": 5 + }, + { + "actions": 59685, + "axes": 2, + "nodes": 1, + "output": [ + 1, + 0 + ], + "precisions": [ + 6 + ], + "private_bound": 669, + "raw_bound": 8976343436, + "retained_private": 650, + "reverse": true, + "width_sum": 5 + }, + { + "actions": 59881, + "axes": 2, + "nodes": 1, + "output": [ + 1, + 3 + ], + "precisions": [ + 6 + ], + "private_bound": 669, + "raw_bound": 8976343436, + "retained_private": 650, + "reverse": true, + "width_sum": 5 + }, + { + "actions": 59876, + "axes": 2, + "nodes": 1, + "output": [ + 1, + 0 + ], + "precisions": [ + 6 + ], + "private_bound": 669, + "raw_bound": 8976343436, + "retained_private": 650, + "reverse": false, + "width_sum": 5 + }, + { + "actions": 59669, + "axes": 2, + "nodes": 1, + "output": [ + 1, + 3 + ], + "precisions": [ + 6 + ], + "private_bound": 669, + "raw_bound": 8976343436, + "retained_private": 650, + "reverse": false, + "width_sum": 5 + }, + { + "actions": 59685, + "axes": 2, + "nodes": 1, + "output": [ + 1, + 1 + ], + "precisions": [ + 6 + ], + "private_bound": 669, + "raw_bound": 8976343436, + "retained_private": 650, + "reverse": true, + "width_sum": 5 + }, + { + "actions": 59876, + "axes": 2, + "nodes": 1, + "output": [ + 1, + 4 + ], + "precisions": [ + 6 + ], + "private_bound": 669, + "raw_bound": 8976343436, + "retained_private": 650, + "reverse": true, + "width_sum": 5 + }, + { + "actions": 59884, + "axes": 2, + "nodes": 1, + "output": [ + 1, + 1 + ], + "precisions": [ + 6 + ], + "private_bound": 669, + "raw_bound": 8976343436, + "retained_private": 650, + "reverse": false, + "width_sum": 5 + }, + { + "actions": 59677, + "axes": 2, + "nodes": 1, + "output": [ + 1, + 4 + ], + "precisions": [ + 6 + ], + "private_bound": 669, + "raw_bound": 8976343436, + "retained_private": 650, + "reverse": false, + "width_sum": 5 + }, + { + "actions": 59693, + "axes": 2, + "nodes": 1, + "output": [ + 1, + 2 + ], + "precisions": [ + 6 + ], + "private_bound": 669, + "raw_bound": 8976343436, + "retained_private": 650, + "reverse": true, + "width_sum": 5 + }, + { + "actions": 59685, + "axes": 2, + "nodes": 1, + "output": [ + 1, + 0 + ], + "precisions": [ + 6 + ], + "private_bound": 669, + "raw_bound": 8976343436, + "retained_private": 650, + "reverse": true, + "width_sum": 5 + }, + { + "actions": 59674, + "axes": 2, + "nodes": 1, + "output": [ + 1, + 2 + ], + "precisions": [ + 6 + ], + "private_bound": 669, + "raw_bound": 8976343436, + "retained_private": 650, + "reverse": false, + "width_sum": 5 + }, + { + "actions": 59876, + "axes": 2, + "nodes": 1, + "output": [ + 1, + 0 + ], + "precisions": [ + 6 + ], + "private_bound": 669, + "raw_bound": 8976343436, + "retained_private": 650, + "reverse": false, + "width_sum": 5 + }, + { + "actions": 59881, + "axes": 2, + "nodes": 1, + "output": [ + 1, + 3 + ], + "precisions": [ + 6 + ], + "private_bound": 669, + "raw_bound": 8976343436, + "retained_private": 650, + "reverse": true, + "width_sum": 5 + }, + { + "actions": 59685, + "axes": 2, + "nodes": 1, + "output": [ + 1, + 1 + ], + "precisions": [ + 6 + ], + "private_bound": 669, + "raw_bound": 8976343436, + "retained_private": 650, + "reverse": true, + "width_sum": 5 + }, + { + "actions": 59669, + "axes": 2, + "nodes": 1, + "output": [ + 1, + 3 + ], + "precisions": [ + 6 + ], + "private_bound": 669, + "raw_bound": 8976343436, + "retained_private": 650, + "reverse": false, + "width_sum": 5 + }, + { + "actions": 59884, + "axes": 2, + "nodes": 1, + "output": [ + 1, + 1 + ], + "precisions": [ + 6 + ], + "private_bound": 669, + "raw_bound": 8976343436, + "retained_private": 650, + "reverse": false, + "width_sum": 5 + }, + { + "actions": 59876, + "axes": 2, + "nodes": 1, + "output": [ + 1, + 4 + ], + "precisions": [ + 6 + ], + "private_bound": 669, + "raw_bound": 8976343436, + "retained_private": 650, + "reverse": true, + "width_sum": 5 + }, + { + "actions": 59693, + "axes": 2, + "nodes": 1, + "output": [ + 1, + 2 + ], + "precisions": [ + 6 + ], + "private_bound": 669, + "raw_bound": 8976343436, + "retained_private": 650, + "reverse": true, + "width_sum": 5 + }, + { + "actions": 59677, + "axes": 2, + "nodes": 1, + "output": [ + 1, + 4 + ], + "precisions": [ + 6 + ], + "private_bound": 669, + "raw_bound": 8976343436, + "retained_private": 650, + "reverse": false, + "width_sum": 5 + }, + { + "actions": 57665, + "axes": 2, + "nodes": 1, + "output": [ + 1, + 5 + ], + "precisions": [ + 6 + ], + "private_bound": 669, + "raw_bound": 8976343436, + "retained_private": 650, + "reverse": false, + "width_sum": 5 + }, + { + "actions": 57673, + "axes": 2, + "nodes": 1, + "output": [ + 1, + 5 + ], + "precisions": [ + 6 + ], + "private_bound": 669, + "raw_bound": 8976343436, + "retained_private": 650, + "reverse": true, + "width_sum": 5 + }, + { + "actions": 57673, + "axes": 2, + "nodes": 1, + "output": [ + 1, + 5 + ], + "precisions": [ + 6 + ], + "private_bound": 669, + "raw_bound": 8976343436, + "retained_private": 650, + "reverse": true, + "width_sum": 5 + }, + { + "actions": 57665, + "axes": 2, + "nodes": 1, + "output": [ + 1, + 5 + ], + "precisions": [ + 6 + ], + "private_bound": 669, + "raw_bound": 8976343436, + "retained_private": 650, + "reverse": false, + "width_sum": 5 + }, + { + "actions": 57665, + "axes": 2, + "nodes": 1, + "output": [ + 1, + 6 + ], + "precisions": [ + 6 + ], + "private_bound": 669, + "raw_bound": 8976343436, + "retained_private": 650, + "reverse": false, + "width_sum": 5 + }, + { + "actions": 57673, + "axes": 2, + "nodes": 1, + "output": [ + 1, + 6 + ], + "precisions": [ + 6 + ], + "private_bound": 669, + "raw_bound": 8976343436, + "retained_private": 650, + "reverse": true, + "width_sum": 5 + }, + { + "actions": 57673, + "axes": 2, + "nodes": 1, + "output": [ + 1, + 6 + ], + "precisions": [ + 6 + ], + "private_bound": 669, + "raw_bound": 8976343436, + "retained_private": 650, + "reverse": true, + "width_sum": 5 + }, + { + "actions": 57665, + "axes": 2, + "nodes": 1, + "output": [ + 1, + 6 + ], + "precisions": [ + 6 + ], + "private_bound": 669, + "raw_bound": 8976343436, + "retained_private": 650, + "reverse": false, + "width_sum": 5 + }, + { + "actions": 57665, + "axes": 2, + "nodes": 1, + "output": [ + 1, + 7 + ], + "precisions": [ + 6 + ], + "private_bound": 669, + "raw_bound": 8976343436, + "retained_private": 650, + "reverse": false, + "width_sum": 5 + }, + { + "actions": 57673, + "axes": 2, + "nodes": 1, + "output": [ + 1, + 7 + ], + "precisions": [ + 6 + ], + "private_bound": 669, + "raw_bound": 8976343436, + "retained_private": 650, + "reverse": true, + "width_sum": 5 + }, + { + "actions": 57673, + "axes": 2, + "nodes": 1, + "output": [ + 1, + 7 + ], + "precisions": [ + 6 + ], + "private_bound": 669, + "raw_bound": 8976343436, + "retained_private": 650, + "reverse": true, + "width_sum": 5 + }, + { + "actions": 57665, + "axes": 2, + "nodes": 1, + "output": [ + 1, + 7 + ], + "precisions": [ + 6 + ], + "private_bound": 669, + "raw_bound": 8976343436, + "retained_private": 650, + "reverse": false, + "width_sum": 5 + }, + { + "actions": 59682, + "axes": 2, + "nodes": 1, + "output": [ + 2, + 4 + ], + "precisions": [ + 6 + ], + "private_bound": 669, + "raw_bound": 8976343436, + "retained_private": 651, + "reverse": false, + "width_sum": 5 + }, + { + "actions": 59701, + "axes": 2, + "nodes": 1, + "output": [ + 2, + 0 + ], + "precisions": [ + 6 + ], + "private_bound": 669, + "raw_bound": 8976343436, + "retained_private": 651, + "reverse": true, + "width_sum": 5 + }, + { + "actions": 59889, + "axes": 2, + "nodes": 1, + "output": [ + 2, + 1 + ], + "precisions": [ + 6 + ], + "private_bound": 669, + "raw_bound": 8976343436, + "retained_private": 651, + "reverse": true, + "width_sum": 5 + }, + { + "actions": 59876, + "axes": 2, + "nodes": 1, + "output": [ + 2, + 0 + ], + "precisions": [ + 6 + ], + "private_bound": 669, + "raw_bound": 8976343436, + "retained_private": 651, + "reverse": false, + "width_sum": 5 + }, + { + "actions": 59876, + "axes": 2, + "nodes": 1, + "output": [ + 2, + 0 + ], + "precisions": [ + 6 + ], + "private_bound": 669, + "raw_bound": 8976343436, + "retained_private": 651, + "reverse": false, + "width_sum": 5 + }, + { + "actions": 59889, + "axes": 2, + "nodes": 1, + "output": [ + 2, + 1 + ], + "precisions": [ + 6 + ], + "private_bound": 669, + "raw_bound": 8976343436, + "retained_private": 651, + "reverse": true, + "width_sum": 5 + }, + { + "actions": 59884, + "axes": 2, + "nodes": 1, + "output": [ + 2, + 2 + ], + "precisions": [ + 6 + ], + "private_bound": 669, + "raw_bound": 8976343436, + "retained_private": 651, + "reverse": true, + "width_sum": 5 + }, + { + "actions": 59884, + "axes": 2, + "nodes": 1, + "output": [ + 2, + 1 + ], + "precisions": [ + 6 + ], + "private_bound": 669, + "raw_bound": 8976343436, + "retained_private": 651, + "reverse": false, + "width_sum": 5 + }, + { + "actions": 59884, + "axes": 2, + "nodes": 1, + "output": [ + 2, + 1 + ], + "precisions": [ + 6 + ], + "private_bound": 669, + "raw_bound": 8976343436, + "retained_private": 651, + "reverse": false, + "width_sum": 5 + }, + { + "actions": 59884, + "axes": 2, + "nodes": 1, + "output": [ + 2, + 2 + ], + "precisions": [ + 6 + ], + "private_bound": 669, + "raw_bound": 8976343436, + "retained_private": 651, + "reverse": true, + "width_sum": 5 + }, + { + "actions": 59892, + "axes": 2, + "nodes": 1, + "output": [ + 2, + 3 + ], + "precisions": [ + 6 + ], + "private_bound": 669, + "raw_bound": 8976343436, + "retained_private": 651, + "reverse": true, + "width_sum": 5 + }, + { + "actions": 59884, + "axes": 2, + "nodes": 1, + "output": [ + 2, + 2 + ], + "precisions": [ + 6 + ], + "private_bound": 669, + "raw_bound": 8976343436, + "retained_private": 651, + "reverse": false, + "width_sum": 5 + }, + { + "actions": 59884, + "axes": 2, + "nodes": 1, + "output": [ + 2, + 2 + ], + "precisions": [ + 6 + ], + "private_bound": 669, + "raw_bound": 8976343436, + "retained_private": 651, + "reverse": false, + "width_sum": 5 + }, + { + "actions": 59892, + "axes": 2, + "nodes": 1, + "output": [ + 2, + 3 + ], + "precisions": [ + 6 + ], + "private_bound": 669, + "raw_bound": 8976343436, + "retained_private": 651, + "reverse": true, + "width_sum": 5 + }, + { + "actions": 59892, + "axes": 2, + "nodes": 1, + "output": [ + 2, + 4 + ], + "precisions": [ + 6 + ], + "private_bound": 669, + "raw_bound": 8976343436, + "retained_private": 651, + "reverse": true, + "width_sum": 5 + }, + { + "actions": 59892, + "axes": 2, + "nodes": 1, + "output": [ + 2, + 3 + ], + "precisions": [ + 6 + ], + "private_bound": 669, + "raw_bound": 8976343436, + "retained_private": 651, + "reverse": false, + "width_sum": 5 + }, + { + "actions": 59892, + "axes": 2, + "nodes": 1, + "output": [ + 2, + 3 + ], + "precisions": [ + 6 + ], + "private_bound": 669, + "raw_bound": 8976343436, + "retained_private": 651, + "reverse": false, + "width_sum": 5 + }, + { + "actions": 59892, + "axes": 2, + "nodes": 1, + "output": [ + 2, + 4 + ], + "precisions": [ + 6 + ], + "private_bound": 669, + "raw_bound": 8976343436, + "retained_private": 651, + "reverse": true, + "width_sum": 5 + }, + { + "actions": 59701, + "axes": 2, + "nodes": 1, + "output": [ + 2, + 0 + ], + "precisions": [ + 6 + ], + "private_bound": 669, + "raw_bound": 8976343436, + "retained_private": 651, + "reverse": true, + "width_sum": 5 + }, + { + "actions": 59682, + "axes": 2, + "nodes": 1, + "output": [ + 2, + 4 + ], + "precisions": [ + 6 + ], + "private_bound": 669, + "raw_bound": 8976343436, + "retained_private": 651, + "reverse": false, + "width_sum": 5 + }, + { + "actions": 57673, + "axes": 2, + "nodes": 1, + "output": [ + 2, + 5 + ], + "precisions": [ + 6 + ], + "private_bound": 669, + "raw_bound": 8976343436, + "retained_private": 651, + "reverse": false, + "width_sum": 5 + }, + { + "actions": 57681, + "axes": 2, + "nodes": 1, + "output": [ + 2, + 5 + ], + "precisions": [ + 6 + ], + "private_bound": 669, + "raw_bound": 8976343436, + "retained_private": 651, + "reverse": true, + "width_sum": 5 + }, + { + "actions": 57681, + "axes": 2, + "nodes": 1, + "output": [ + 2, + 5 + ], + "precisions": [ + 6 + ], + "private_bound": 669, + "raw_bound": 8976343436, + "retained_private": 651, + "reverse": true, + "width_sum": 5 + }, + { + "actions": 57673, + "axes": 2, + "nodes": 1, + "output": [ + 2, + 5 + ], + "precisions": [ + 6 + ], + "private_bound": 669, + "raw_bound": 8976343436, + "retained_private": 651, + "reverse": false, + "width_sum": 5 + }, + { + "actions": 57673, + "axes": 2, + "nodes": 1, + "output": [ + 2, + 6 + ], + "precisions": [ + 6 + ], + "private_bound": 669, + "raw_bound": 8976343436, + "retained_private": 651, + "reverse": false, + "width_sum": 5 + }, + { + "actions": 57681, + "axes": 2, + "nodes": 1, + "output": [ + 2, + 6 + ], + "precisions": [ + 6 + ], + "private_bound": 669, + "raw_bound": 8976343436, + "retained_private": 651, + "reverse": true, + "width_sum": 5 + }, + { + "actions": 57681, + "axes": 2, + "nodes": 1, + "output": [ + 2, + 6 + ], + "precisions": [ + 6 + ], + "private_bound": 669, + "raw_bound": 8976343436, + "retained_private": 651, + "reverse": true, + "width_sum": 5 + }, + { + "actions": 57673, + "axes": 2, + "nodes": 1, + "output": [ + 2, + 6 + ], + "precisions": [ + 6 + ], + "private_bound": 669, + "raw_bound": 8976343436, + "retained_private": 651, + "reverse": false, + "width_sum": 5 + }, + { + "actions": 57673, + "axes": 2, + "nodes": 1, + "output": [ + 2, + 7 + ], + "precisions": [ + 6 + ], + "private_bound": 669, + "raw_bound": 8976343436, + "retained_private": 651, + "reverse": false, + "width_sum": 5 + }, + { + "actions": 57681, + "axes": 2, + "nodes": 1, + "output": [ + 2, + 7 + ], + "precisions": [ + 6 + ], + "private_bound": 669, + "raw_bound": 8976343436, + "retained_private": 651, + "reverse": true, + "width_sum": 5 + }, + { + "actions": 57681, + "axes": 2, + "nodes": 1, + "output": [ + 2, + 7 + ], + "precisions": [ + 6 + ], + "private_bound": 669, + "raw_bound": 8976343436, + "retained_private": 651, + "reverse": true, + "width_sum": 5 + }, + { + "actions": 57673, + "axes": 2, + "nodes": 1, + "output": [ + 2, + 7 + ], + "precisions": [ + 6 + ], + "private_bound": 669, + "raw_bound": 8976343436, + "retained_private": 651, + "reverse": false, + "width_sum": 5 + }, + { + "actions": 59786, + "axes": 2, + "nodes": 1, + "output": [ + 3, + 0 + ], + "precisions": [ + 6 + ], + "private_bound": 669, + "raw_bound": 8976343436, + "retained_private": 651, + "reverse": false, + "width_sum": 5 + }, + { + "actions": 59794, + "axes": 2, + "nodes": 1, + "output": [ + 3, + 0 + ], + "precisions": [ + 6 + ], + "private_bound": 669, + "raw_bound": 8976343436, + "retained_private": 651, + "reverse": true, + "width_sum": 5 + }, + { + "actions": 59794, + "axes": 2, + "nodes": 1, + "output": [ + 3, + 0 + ], + "precisions": [ + 6 + ], + "private_bound": 669, + "raw_bound": 8976343436, + "retained_private": 651, + "reverse": true, + "width_sum": 5 + }, + { + "actions": 59786, + "axes": 2, + "nodes": 1, + "output": [ + 3, + 0 + ], + "precisions": [ + 6 + ], + "private_bound": 669, + "raw_bound": 8976343436, + "retained_private": 651, + "reverse": false, + "width_sum": 5 + }, + { + "actions": 59781, + "axes": 2, + "nodes": 1, + "output": [ + 3, + 1 + ], + "precisions": [ + 6 + ], + "private_bound": 669, + "raw_bound": 8976343436, + "retained_private": 651, + "reverse": false, + "width_sum": 5 + }, + { + "actions": 59789, + "axes": 2, + "nodes": 1, + "output": [ + 3, + 1 + ], + "precisions": [ + 6 + ], + "private_bound": 669, + "raw_bound": 8976343436, + "retained_private": 651, + "reverse": true, + "width_sum": 5 + }, + { + "actions": 59789, + "axes": 2, + "nodes": 1, + "output": [ + 3, + 1 + ], + "precisions": [ + 6 + ], + "private_bound": 669, + "raw_bound": 8976343436, + "retained_private": 651, + "reverse": true, + "width_sum": 5 + }, + { + "actions": 59781, + "axes": 2, + "nodes": 1, + "output": [ + 3, + 1 + ], + "precisions": [ + 6 + ], + "private_bound": 669, + "raw_bound": 8976343436, + "retained_private": 651, + "reverse": false, + "width_sum": 5 + }, + { + "actions": 59789, + "axes": 2, + "nodes": 1, + "output": [ + 3, + 2 + ], + "precisions": [ + 6 + ], + "private_bound": 669, + "raw_bound": 8976343436, + "retained_private": 651, + "reverse": false, + "width_sum": 5 + }, + { + "actions": 59797, + "axes": 2, + "nodes": 1, + "output": [ + 3, + 2 + ], + "precisions": [ + 6 + ], + "private_bound": 669, + "raw_bound": 8976343436, + "retained_private": 651, + "reverse": true, + "width_sum": 5 + }, + { + "actions": 59797, + "axes": 2, + "nodes": 1, + "output": [ + 3, + 2 + ], + "precisions": [ + 6 + ], + "private_bound": 669, + "raw_bound": 8976343436, + "retained_private": 651, + "reverse": true, + "width_sum": 5 + }, + { + "actions": 59789, + "axes": 2, + "nodes": 1, + "output": [ + 3, + 2 + ], + "precisions": [ + 6 + ], + "private_bound": 669, + "raw_bound": 8976343436, + "retained_private": 651, + "reverse": false, + "width_sum": 5 + }, + { + "actions": 59789, + "axes": 2, + "nodes": 1, + "output": [ + 3, + 3 + ], + "precisions": [ + 6 + ], + "private_bound": 669, + "raw_bound": 8976343436, + "retained_private": 651, + "reverse": false, + "width_sum": 5 + }, + { + "actions": 59797, + "axes": 2, + "nodes": 1, + "output": [ + 3, + 3 + ], + "precisions": [ + 6 + ], + "private_bound": 669, + "raw_bound": 8976343436, + "retained_private": 651, + "reverse": true, + "width_sum": 5 + }, + { + "actions": 59797, + "axes": 2, + "nodes": 1, + "output": [ + 3, + 3 + ], + "precisions": [ + 6 + ], + "private_bound": 669, + "raw_bound": 8976343436, + "retained_private": 651, + "reverse": true, + "width_sum": 5 + }, + { + "actions": 59789, + "axes": 2, + "nodes": 1, + "output": [ + 3, + 3 + ], + "precisions": [ + 6 + ], + "private_bound": 669, + "raw_bound": 8976343436, + "retained_private": 651, + "reverse": false, + "width_sum": 5 + }, + { + "actions": 59797, + "axes": 2, + "nodes": 1, + "output": [ + 3, + 4 + ], + "precisions": [ + 6 + ], + "private_bound": 669, + "raw_bound": 8976343436, + "retained_private": 651, + "reverse": false, + "width_sum": 5 + }, + { + "actions": 59805, + "axes": 2, + "nodes": 1, + "output": [ + 3, + 4 + ], + "precisions": [ + 6 + ], + "private_bound": 669, + "raw_bound": 8976343436, + "retained_private": 651, + "reverse": true, + "width_sum": 5 + }, + { + "actions": 59805, + "axes": 2, + "nodes": 1, + "output": [ + 3, + 4 + ], + "precisions": [ + 6 + ], + "private_bound": 669, + "raw_bound": 8976343436, + "retained_private": 651, + "reverse": true, + "width_sum": 5 + }, + { + "actions": 59797, + "axes": 2, + "nodes": 1, + "output": [ + 3, + 4 + ], + "precisions": [ + 6 + ], + "private_bound": 669, + "raw_bound": 8976343436, + "retained_private": 651, + "reverse": false, + "width_sum": 5 + }, + { + "actions": 57777, + "axes": 2, + "nodes": 1, + "output": [ + 3, + 5 + ], + "precisions": [ + 6 + ], + "private_bound": 669, + "raw_bound": 8976343436, + "retained_private": 651, + "reverse": false, + "width_sum": 5 + }, + { + "actions": 57785, + "axes": 2, + "nodes": 1, + "output": [ + 3, + 5 + ], + "precisions": [ + 6 + ], + "private_bound": 669, + "raw_bound": 8976343436, + "retained_private": 651, + "reverse": true, + "width_sum": 5 + }, + { + "actions": 57785, + "axes": 2, + "nodes": 1, + "output": [ + 3, + 5 + ], + "precisions": [ + 6 + ], + "private_bound": 669, + "raw_bound": 8976343436, + "retained_private": 651, + "reverse": true, + "width_sum": 5 + }, + { + "actions": 57777, + "axes": 2, + "nodes": 1, + "output": [ + 3, + 5 + ], + "precisions": [ + 6 + ], + "private_bound": 669, + "raw_bound": 8976343436, + "retained_private": 651, + "reverse": false, + "width_sum": 5 + }, + { + "actions": 57777, + "axes": 2, + "nodes": 1, + "output": [ + 3, + 6 + ], + "precisions": [ + 6 + ], + "private_bound": 669, + "raw_bound": 8976343436, + "retained_private": 651, + "reverse": false, + "width_sum": 5 + }, + { + "actions": 57785, + "axes": 2, + "nodes": 1, + "output": [ + 3, + 6 + ], + "precisions": [ + 6 + ], + "private_bound": 669, + "raw_bound": 8976343436, + "retained_private": 651, + "reverse": true, + "width_sum": 5 + }, + { + "actions": 57785, + "axes": 2, + "nodes": 1, + "output": [ + 3, + 6 + ], + "precisions": [ + 6 + ], + "private_bound": 669, + "raw_bound": 8976343436, + "retained_private": 651, + "reverse": true, + "width_sum": 5 + }, + { + "actions": 57777, + "axes": 2, + "nodes": 1, + "output": [ + 3, + 6 + ], + "precisions": [ + 6 + ], + "private_bound": 669, + "raw_bound": 8976343436, + "retained_private": 651, + "reverse": false, + "width_sum": 5 + }, + { + "actions": 57777, + "axes": 2, + "nodes": 1, + "output": [ + 3, + 7 + ], + "precisions": [ + 6 + ], + "private_bound": 669, + "raw_bound": 8976343436, + "retained_private": 651, + "reverse": false, + "width_sum": 5 + }, + { + "actions": 57785, + "axes": 2, + "nodes": 1, + "output": [ + 3, + 7 + ], + "precisions": [ + 6 + ], + "private_bound": 669, + "raw_bound": 8976343436, + "retained_private": 651, + "reverse": true, + "width_sum": 5 + }, + { + "actions": 57785, + "axes": 2, + "nodes": 1, + "output": [ + 3, + 7 + ], + "precisions": [ + 6 + ], + "private_bound": 669, + "raw_bound": 8976343436, + "retained_private": 651, + "reverse": true, + "width_sum": 5 + }, + { + "actions": 57777, + "axes": 2, + "nodes": 1, + "output": [ + 3, + 7 + ], + "precisions": [ + 6 + ], + "private_bound": 669, + "raw_bound": 8976343436, + "retained_private": 651, + "reverse": false, + "width_sum": 5 + } + ], + "initial_private_backing": 79, + "max_axes": 2, + "max_width_sum": 5, + "protected_private_left_backing": 0, + "roles": 79, + "supplied_clean_history": false, + "translated_origins": false + }, + { + "acquisition_actions": 1264, + "calls": [ + { + "actions": 357056, + "axes": 4, + "nodes": 3, + "output": [ + 0, + 0, + 0, + 0 + ], + "precisions": [ + 5, + 7, + 11 + ], + "private_bound": 1175, + "raw_bound": 80021766540, + "retained_private": 1133, + "reverse": false, + "width_sum": 10 + }, + { + "actions": 357145, + "axes": 4, + "nodes": 3, + "output": [ + 0, + 0, + 0, + 0 + ], + "precisions": [ + 11, + 5, + 7 + ], + "private_bound": 1175, + "raw_bound": 80021766540, + "retained_private": 1133, + "reverse": true, + "width_sum": 10 + }, + { + "actions": 357145, + "axes": 4, + "nodes": 3, + "output": [ + 0, + 0, + 0, + 0 + ], + "precisions": [ + 11, + 5, + 7 + ], + "private_bound": 1175, + "raw_bound": 80021766540, + "retained_private": 1133, + "reverse": true, + "width_sum": 10 + }, + { + "actions": 357056, + "axes": 4, + "nodes": 3, + "output": [ + 0, + 0, + 0, + 0 + ], + "precisions": [ + 5, + 7, + 11 + ], + "private_bound": 1175, + "raw_bound": 80021766540, + "retained_private": 1133, + "reverse": false, + "width_sum": 10 + }, + { + "actions": 360114, + "axes": 4, + "nodes": 3, + "output": [ + 1, + 1, + 4, + 3 + ], + "precisions": [ + 5, + 7, + 11 + ], + "private_bound": 1175, + "raw_bound": 80021766540, + "retained_private": 1137, + "reverse": false, + "width_sum": 10 + }, + { + "actions": 360187, + "axes": 4, + "nodes": 3, + "output": [ + 1, + 2, + 4, + 6 + ], + "precisions": [ + 11, + 5, + 7 + ], + "private_bound": 1175, + "raw_bound": 80021766540, + "retained_private": 1137, + "reverse": true, + "width_sum": 10 + }, + { + "actions": 358353, + "axes": 4, + "nodes": 3, + "output": [ + 1, + 0, + 3, + 0 + ], + "precisions": [ + 11, + 5, + 7 + ], + "private_bound": 1175, + "raw_bound": 80021766540, + "retained_private": 1138, + "reverse": true, + "width_sum": 10 + }, + { + "actions": 358242, + "axes": 4, + "nodes": 3, + "output": [ + 1, + 2, + 4, + 6 + ], + "precisions": [ + 5, + 7, + 11 + ], + "private_bound": 1175, + "raw_bound": 80021766540, + "retained_private": 1138, + "reverse": false, + "width_sum": 10 + }, + { + "actions": 359277, + "axes": 4, + "nodes": 3, + "output": [ + 1, + 0, + 4, + 2 + ], + "precisions": [ + 5, + 7, + 11 + ], + "private_bound": 1175, + "raw_bound": 80021766540, + "retained_private": 1138, + "reverse": false, + "width_sum": 10 + }, + { + "actions": 359395, + "axes": 4, + "nodes": 3, + "output": [ + 1, + 1, + 1, + 1 + ], + "precisions": [ + 11, + 5, + 7 + ], + "private_bound": 1175, + "raw_bound": 80021766540, + "retained_private": 1138, + "reverse": true, + "width_sum": 10 + }, + { + "actions": 359913, + "axes": 4, + "nodes": 3, + "output": [ + 1, + 2, + 1, + 6 + ], + "precisions": [ + 11, + 5, + 7 + ], + "private_bound": 1175, + "raw_bound": 80021766540, + "retained_private": 1138, + "reverse": true, + "width_sum": 10 + }, + { + "actions": 359848, + "axes": 4, + "nodes": 3, + "output": [ + 1, + 1, + 1, + 1 + ], + "precisions": [ + 5, + 7, + 11 + ], + "private_bound": 1175, + "raw_bound": 80021766540, + "retained_private": 1138, + "reverse": false, + "width_sum": 10 + }, + { + "actions": 358953, + "axes": 4, + "nodes": 3, + "output": [ + 3, + 2, + 4, + 4 + ], + "precisions": [ + 5, + 7, + 11 + ], + "private_bound": 1175, + "raw_bound": 80021766540, + "retained_private": 1139, + "reverse": false, + "width_sum": 10 + }, + { + "actions": 359042, + "axes": 4, + "nodes": 3, + "output": [ + 3, + 2, + 4, + 6 + ], + "precisions": [ + 11, + 5, + 7 + ], + "private_bound": 1175, + "raw_bound": 80021766540, + "retained_private": 1139, + "reverse": true, + "width_sum": 10 + }, + { + "actions": 358816, + "axes": 4, + "nodes": 3, + "output": [ + 3, + 2, + 4, + 1 + ], + "precisions": [ + 11, + 5, + 7 + ], + "private_bound": 1175, + "raw_bound": 80021766540, + "retained_private": 1139, + "reverse": true, + "width_sum": 10 + }, + { + "actions": 358711, + "axes": 4, + "nodes": 3, + "output": [ + 3, + 2, + 4, + 6 + ], + "precisions": [ + 5, + 7, + 11 + ], + "private_bound": 1175, + "raw_bound": 80021766540, + "retained_private": 1139, + "reverse": false, + "width_sum": 10 + }, + { + "actions": 357413, + "axes": 4, + "nodes": 3, + "output": [ + 1, + 3, + 1, + 4 + ], + "precisions": [ + 5, + 7, + 11 + ], + "private_bound": 1175, + "raw_bound": 80021766540, + "retained_private": 1139, + "reverse": false, + "width_sum": 10 + }, + { + "actions": 357518, + "axes": 4, + "nodes": 3, + "output": [ + 1, + 3, + 1, + 1 + ], + "precisions": [ + 11, + 5, + 7 + ], + "private_bound": 1175, + "raw_bound": 80021766540, + "retained_private": 1139, + "reverse": true, + "width_sum": 10 + }, + { + "actions": 357712, + "axes": 4, + "nodes": 3, + "output": [ + 1, + 3, + 1, + 5 + ], + "precisions": [ + 11, + 5, + 7 + ], + "private_bound": 1175, + "raw_bound": 80021766540, + "retained_private": 1139, + "reverse": true, + "width_sum": 10 + }, + { + "actions": 357639, + "axes": 4, + "nodes": 3, + "output": [ + 1, + 3, + 1, + 1 + ], + "precisions": [ + 5, + 7, + 11 + ], + "private_bound": 1175, + "raw_bound": 80021766540, + "retained_private": 1139, + "reverse": false, + "width_sum": 10 + }, + { + "actions": 345013, + "axes": 4, + "nodes": 3, + "output": [ + 3, + 3, + 7, + 7 + ], + "precisions": [ + 5, + 7, + 11 + ], + "private_bound": 1175, + "raw_bound": 80021766540, + "retained_private": 1139, + "reverse": false, + "width_sum": 10 + }, + { + "actions": 345102, + "axes": 4, + "nodes": 3, + "output": [ + 3, + 3, + 7, + 7 + ], + "precisions": [ + 11, + 5, + 7 + ], + "private_bound": 1175, + "raw_bound": 80021766540, + "retained_private": 1139, + "reverse": true, + "width_sum": 10 + }, + { + "actions": 345102, + "axes": 4, + "nodes": 3, + "output": [ + 3, + 3, + 7, + 7 + ], + "precisions": [ + 11, + 5, + 7 + ], + "private_bound": 1175, + "raw_bound": 80021766540, + "retained_private": 1139, + "reverse": true, + "width_sum": 10 + }, + { + "actions": 345013, + "axes": 4, + "nodes": 3, + "output": [ + 3, + 3, + 7, + 7 + ], + "precisions": [ + 5, + 7, + 11 + ], + "private_bound": 1175, + "raw_bound": 80021766540, + "retained_private": 1139, + "reverse": false, + "width_sum": 10 + }, + { + "actions": 357714, + "axes": 4, + "nodes": 3, + "output": [ + 0, + 1, + 2, + 1 + ], + "precisions": [ + 5, + 7, + 11 + ], + "private_bound": 1175, + "raw_bound": 80021766540, + "retained_private": 1139, + "reverse": false, + "width_sum": 10 + }, + { + "actions": 357801, + "axes": 4, + "nodes": 3, + "output": [ + 0, + 1, + 0, + 0 + ], + "precisions": [ + 11, + 5, + 7 + ], + "private_bound": 1175, + "raw_bound": 80021766540, + "retained_private": 1139, + "reverse": true, + "width_sum": 10 + }, + { + "actions": 359163, + "axes": 4, + "nodes": 3, + "output": [ + 0, + 1, + 3, + 4 + ], + "precisions": [ + 11, + 5, + 7 + ], + "private_bound": 1175, + "raw_bound": 80021766540, + "retained_private": 1139, + "reverse": true, + "width_sum": 10 + }, + { + "actions": 359088, + "axes": 4, + "nodes": 3, + "output": [ + 0, + 1, + 0, + 0 + ], + "precisions": [ + 5, + 7, + 11 + ], + "private_bound": 1175, + "raw_bound": 80021766540, + "retained_private": 1139, + "reverse": false, + "width_sum": 10 + }, + { + "actions": 358167, + "axes": 4, + "nodes": 3, + "output": [ + 0, + 1, + 4, + 1 + ], + "precisions": [ + 5, + 7, + 11 + ], + "private_bound": 1175, + "raw_bound": 80021766540, + "retained_private": 1139, + "reverse": false, + "width_sum": 10 + }, + { + "actions": 358264, + "axes": 4, + "nodes": 3, + "output": [ + 0, + 1, + 2, + 1 + ], + "precisions": [ + 11, + 5, + 7 + ], + "private_bound": 1175, + "raw_bound": 80021766540, + "retained_private": 1139, + "reverse": true, + "width_sum": 10 + }, + { + "actions": 357801, + "axes": 4, + "nodes": 3, + "output": [ + 0, + 1, + 0, + 0 + ], + "precisions": [ + 11, + 5, + 7 + ], + "private_bound": 1175, + "raw_bound": 80021766540, + "retained_private": 1139, + "reverse": true, + "width_sum": 10 + }, + { + "actions": 357714, + "axes": 4, + "nodes": 3, + "output": [ + 0, + 1, + 2, + 1 + ], + "precisions": [ + 5, + 7, + 11 + ], + "private_bound": 1175, + "raw_bound": 80021766540, + "retained_private": 1139, + "reverse": false, + "width_sum": 10 + } + ], + "initial_private_backing": 79, + "max_axes": 4, + "max_width_sum": 10, + "protected_private_left_backing": 0, + "roles": 79, + "supplied_clean_history": false, + "translated_origins": false + }, + { + "acquisition_actions": 316, + "calls": [ + { + "actions": 57777, + "axes": 2, + "nodes": 1, + "output": [ + 3, + 7 + ], + "precisions": [ + 6 + ], + "private_bound": 4082, + "raw_bound": 8976343436, + "retained_private": 4082, + "reverse": false, + "width_sum": 5 + }, + { + "actions": 57785, + "axes": 2, + "nodes": 1, + "output": [ + 3, + 7 + ], + "precisions": [ + 6 + ], + "private_bound": 4082, + "raw_bound": 8976343436, + "retained_private": 4082, + "reverse": true, + "width_sum": 5 + }, + { + "actions": 6188114, + "axes": 8, + "nodes": 7, + "output": [ + 1, + 0, + 2, + 1, + 6, + 10, + 6, + 18 + ], + "precisions": [ + 37, + 17, + 21, + 9, + 9, + 11, + 11 + ], + "private_bound": 5554, + "raw_bound": 5904079487372, + "retained_private": 5459, + "reverse": true, + "width_sum": 36 + }, + { + "actions": 6187909, + "axes": 8, + "nodes": 7, + "output": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8 + ], + "precisions": [ + 9, + 9, + 11, + 11, + 17, + 21, + 37 + ], + "private_bound": 5554, + "raw_bound": 5904079487372, + "retained_private": 5460, + "reverse": false, + "width_sum": 36 + }, + { + "actions": 357413, + "axes": 4, + "nodes": 3, + "output": [ + 1, + 3, + 1, + 4 + ], + "precisions": [ + 5, + 7, + 11 + ], + "private_bound": 5554, + "raw_bound": 80021766540, + "retained_private": 5460, + "reverse": false, + "width_sum": 10 + }, + { + "actions": 357518, + "axes": 4, + "nodes": 3, + "output": [ + 1, + 3, + 1, + 1 + ], + "precisions": [ + 11, + 5, + 7 + ], + "private_bound": 5554, + "raw_bound": 80021766540, + "retained_private": 5460, + "reverse": true, + "width_sum": 10 + }, + { + "actions": 77357, + "axes": 2, + "nodes": 1, + "output": [ + 7, + 15 + ], + "precisions": [ + 8 + ], + "private_bound": 5554, + "raw_bound": 21549031820, + "retained_private": 5460, + "reverse": true, + "width_sum": 7 + }, + { + "actions": 77349, + "axes": 2, + "nodes": 1, + "output": [ + 7, + 15 + ], + "precisions": [ + 8 + ], + "private_bound": 5554, + "raw_bound": 21549031820, + "retained_private": 5460, + "reverse": false, + "width_sum": 7 + }, + { + "actions": 803752, + "axes": 4, + "nodes": 3, + "output": [ + 15, + 4, + 31, + 30 + ], + "precisions": [ + 19, + 9, + 11 + ], + "private_bound": 5554, + "raw_bound": 501376303500, + "retained_private": 5460, + "reverse": true, + "width_sum": 18 + }, + { + "actions": 803663, + "axes": 4, + "nodes": 3, + "output": [ + 15, + 4, + 31, + 30 + ], + "precisions": [ + 9, + 11, + 19 + ], + "private_bound": 5554, + "raw_bound": 501376303500, + "retained_private": 5460, + "reverse": false, + "width_sum": 18 + }, + { + "actions": 7308547, + "axes": 8, + "nodes": 7, + "output": [ + 31, + 2, + 3, + 6, + 31, + 6, + 7, + 14 + ], + "precisions": [ + 11, + 11, + 11, + 11, + 21, + 21, + 41 + ], + "private_bound": 5800, + "raw_bound": 8596064534924, + "retained_private": 5695, + "reverse": false, + "width_sum": 40 + }, + { + "actions": 7308749, + "axes": 8, + "nodes": 7, + "output": [ + 31, + 2, + 3, + 4, + 31, + 6, + 7, + 8 + ], + "precisions": [ + 41, + 21, + 21, + 11, + 11, + 11, + 11 + ], + "private_bound": 5800, + "raw_bound": 8596064534924, + "retained_private": 5695, + "reverse": true, + "width_sum": 40 + }, + { + "actions": 59685, + "axes": 2, + "nodes": 1, + "output": [ + 1, + 0 + ], + "precisions": [ + 6 + ], + "private_bound": 5800, + "raw_bound": 8976343436, + "retained_private": 5695, + "reverse": true, + "width_sum": 5 + }, + { + "actions": 59674, + "axes": 2, + "nodes": 1, + "output": [ + 1, + 2 + ], + "precisions": [ + 6 + ], + "private_bound": 5800, + "raw_bound": 8976343436, + "retained_private": 5695, + "reverse": false, + "width_sum": 5 + } + ], + "initial_private_backing": 4076, + "max_axes": 8, + "max_width_sum": 40, + "protected_private_left_backing": 711, + "roles": 79, + "supplied_clean_history": true, + "translated_origins": true + } + ], + "source_count": 10, + "status": "PASS_ENCODED_CRT_PERSISTENT_RESTART" +} diff --git a/research/encoded-crt-restart/REVIEW.md b/research/encoded-crt-restart/REVIEW.md new file mode 100644 index 0000000000..01e4404cba --- /dev/null +++ b/research/encoded-crt-restart/REVIEW.md @@ -0,0 +1,64 @@ +# Independent source and proof review + +The root orchestrator independently reviewed `restart.py`, the complete proof, +the exact role layout and source contracts. This is a separate AI review with +substantial OpenAI assistance for @CubeJerry, not human or formal-kernel acceptance. +Canonical base is `e54523517d0f03e58352e647c403a5af3e525a57`. + +## Mathematical findings + +The new claim follows by induction over successful linear-use calls. The entry +premise includes every historical cell being blank. Rearm changes only the +sixteen markers; pinned consumers erase their complete current extents. Cells +past those extents stay blank from the induction hypothesis. Consequently a +shorter call need not rescan old capacity, and later growth preserves the same +physical owner. The two local validation reads do not prove arbitrary unseen +tails clean; no dirty-tail admission or failure recovery is claimed. + +The 79 physical roles are stable across calls, including the retained 63-role +bank. Source production, re-encoding, retained prefixes and payload transport +remain caller bills. Direct addition of the displayed role vector yields +`3Ad + 74A + 23d + 223`. Each component is monotone, so summing individual +historical maxima gives the stated `K0+D(Amax,dmax)` bound. The proof does not +replace this sum by a maximum of total fresh footprints. Source-operation +constants remain distinct from a literal binary instruction certificate. + +## Independent computation + +`independent/check.py` imports the production adapter and pinned runtime, but +neither author verifier nor its exhaustive defining-congruence oracle. It +constructs each expected current-node CRT value using modular inverses and +successive congruence reconstruction, then evaluates forward or reversed +balanced levels independently. Its freshly encoded inputs exercise 32 complete +calls, 96 numerical nodes, both directions, padded values, and 2/4/8/2-axis +geometry changes. Source metadata/tails, full blank private tails, head returns, +identities, meters, nonshortening histories and the storage polynomial are +checked. New physical constructors are sealed after acquisition. + +Run from the repository root: + +```sh +python3 -I -W error -B research/encoded-crt-restart/independent/check.py +``` + +The exact receipt is `independent/RESULT.json`: 32 calls, 96 nodes, one 79-role +inventory, 4172 retained cells. Author normal and optimized replays separately +cover 174 calls, 270 nodes and 14 negative controls. These finite cases are +corroboration of the source-relative proof, not a universal theorem by testing. + +`independent/SOURCE-BINDINGS.json` records the independent binding of all ten +exported files to their actual commit paths, Git object hashes, SHA-256 values +and byte counts. No predecessor file was edited. + +## Reviewed scientific bytes and limits + +- `restart.py`: `462fd6f2a0bc0b5eaf5d74d2bda65b0c26ababbbafc06670e2a0cc9e46b5e7d6` +- `PROOF.md`: `40d60f9894bcae292bd35b436efed1d6e53615d6a6782af9e8b6842da2e44772` +- `checks.py`: `43e88fd7426623b71fa33dfe4913d765cc4c7493d55a4c9bec8e34353636bb74` +- `verify.py`: `1d47929cd7bb04e3549b52176cca9b9f1fed2ebf1af064789121e7a0e901f20e` + +No critical unresolved issue was found in this scoped restart argument. +Numerical/source predecessor contracts, clean initial history, legal successful +linear use, and source-model refinement remain explicit premises. Actual +exceptional-key caller admission, complete binary lowering and all five global +assumptions remain open. No new kappa is claimed. diff --git a/research/encoded-crt-restart/SOURCES.json b/research/encoded-crt-restart/SOURCES.json new file mode 100644 index 0000000000..f02dbf3853 --- /dev/null +++ b/research/encoded-crt-restart/SOURCES.json @@ -0,0 +1,55 @@ +{ + "schema_version": 1, + "base_commit": "e54523517d0f03e58352e647c403a5af3e525a57", + "files": [ + { + "path": "research/r437-preparation-composition/predecessor4025/source/words.py", + "usage": "provenance", + "git_blob": "8d4ba37e2778acb35b34e0719df2caf138fbeb50", + "sha256": "5c37f57708ba3131bdcb03139f9dbc29886bee44569c09cbba51b68f75acd7f9" + }, + { + "path": "research/r437-preparation-composition/predecessor4025/source/records.py", + "usage": "provenance", + "git_blob": "4f00467a0ff580954ad2fd0c7380240c753ddef3", + "sha256": "0c9c4b23e998597fb877bb1a29da69ac869b68262abe635b162b4dba9c69b372" + }, + { + "path": "research/encoded-crt-entry-lifecycle/entry.py", + "usage": "provenance", + "git_blob": "1fa2b0cb88320d4f5b623554bb0fc6de332b773c", + "sha256": "0537ec98f306270c8ff6a424841886cf53f675d9947029347090c7dc779616d7" + }, + { + "path": "research/encoded-current-crt/producer.py", + "usage": "provenance", + "git_blob": "a327b0161eca57a1cc44ec2aa8e3defed2167ddc", + "sha256": "88dab4ca02a92164a67826db361214fa1405e4b4a588f8c4279a21bcee95ab76" + }, + { + "path": "research/crt-persistent-numerical-owner/owner.py", + "usage": "provenance", + "git_blob": "20ef3519b6fef691ec92b7315e320b5e8ce9bf18", + "sha256": "1d73f432f8de9c791260c43335eb207d82bbb3f5b190cc76d0d914a4db076f41" + }, + { + "path": "research/crt-mixed-row-entry/bridge.py", + "usage": "provenance", + "git_blob": "57f6853e262a6136bc616f1e47a31d0ace28495c", + "sha256": "89c38638c0d66da731566c903c32e7fa1ad31088d29cfd2634fce823dd07c1f9" + }, + { + "path": "docs/research/agent-task-catalog.json", + "usage": "provenance", + "git_blob": "3404fbdd5e7529a0674eef26114b5071e4586cec", + "sha256": "ead6cdc9d0af6d58e8a49744d8ec8c7c15e13d2ba93c276c434bcf9b51b93a81" + }, + { + "path": "certificates/selected-result.json", + "usage": "provenance", + "git_blob": "75d77b328ea02ded535e7f23aee5b1e55d0bb1a8", + "sha256": "154c3d30455d778fd3343b6b4851f0fa4665f0f7625b0adb3675e2bafbbf6bf1" + } + ], + "export_note": "All runtime inputs are package-local exact exports authenticated by EXPORT-PINS.json. Pending frontend, forward writer and inverse modules retain their exact repository/commit/blob/SHA256 pins in that manifest; no nonancestor Git object or network fetch is needed to replay. The source writer was additionally checked byte-identical at the current #7351 head d2ed3959c30528b0b85fc6d815d4ad4f94f6be86." +} diff --git a/research/encoded-crt-restart/TASK.json b/research/encoded-crt-restart/TASK.json new file mode 100644 index 0000000000..823cf7f6f8 --- /dev/null +++ b/research/encoded-crt-restart/TASK.json @@ -0,0 +1,96 @@ +{ + "schema_version": 1, + "task_id": "uniform-transfer-audit", + "priority_revision": 8, + "base_commit": "e54523517d0f03e58352e647c403a5af3e525a57", + "original_card": { + "id": "uniform-transfer-audit", + "question": "Can one of the selected record's five inherited assumptions be proved at its actual caller?", + "starting_points": [ + "docs/research/current-priorities.md", + "docs/research/research-family-status.md", + "certificates/selected-result.json", + "docs/research/pr-intake-evidence/pr5599-completion/PROOF-REVIEW.md" + ], + "methods": [ + "Construct and independently check one source-bound instance of the stated first experiment.", + "Seek an exact counterexample or target-specific complete-budget obstruction to that same proposed change." + ], + "acceptance_gate": "Identify the proposition and what would change downstream; do not equate a finite replay with a universal proof.", + "first_step": { + "command": [ + "python3", + "-B", + "scripts/research_selected_baseline.py" + ], + "expected": "PASS_RESEARCH_BASELINE_BINDINGS_ONLY", + "inspect": "Read revision 8, the selected review and live exact-source handoffs. Then follow this card's bounded first_experiment.", + "scope": "Source-bound orientation only, not a supplier replay or theorem proof." + }, + "first_experiment": "Choose one assumption ID (native_all_columns, owned_erasure, compiler, precision_tape, analytic_recovery), one quantified implication and exact dependency closure. Check current handoffs, including #5625 row reentry and #5707 root-prefix lowering, without treating their partial scope as the whole theorem. Prove or falsify that implication with a caller-bound argument; stop at the chosen obligation. Finite tests or root digits do not discharge an all-size statement.", + "bottleneck_link": "Judge the actual current supplier contract and complete signed target/paid bill; frozen-profile ceilings require an applicability proof.", + "allowed_variations": [ + "One exact source head, helper/cut region or quantified proposition and changed hypothesis; check live handoffs first. Different seeds are not different scopes." + ], + "scope_change_triggers": [ + "Changing source head, helper/cut domain, operation alphabet or caller boundary without recording the new scope.", + "Treating an archived proposal or local numerical pass as complete supplier admission." + ], + "overlap_terms": [ + "native_all_columns", + "owned_erasure", + "compiler", + "precision_tape", + "analytic_recovery" + ], + "existing_checks": [ + { + "scope": "PR #4100: proposed unconditional construction and finite checks, without independent acceptance.", + "evidence": "research/unconditional-batched-crt/README.md", + "remaining": "Independent proof audit of one caller-bound all-size implication; all other premises remain explicit.", + "status": "author-checked", + "source_commit": "337d04939571a637aeab54a0f58f54fde811663a", + "selected_record_sha256": "bb2eaa58647b353f88d0aec2eafb9d30df1be53589231b23e12ceef3e4bad129" + }, + { + "scope": "Selected PR5599: complete helper-subspace construction and independent caller replay; five framework assumptions remain.", + "evidence": "docs/research/pr-intake-evidence/pr5599-completion/PROOF-REVIEW.md", + "remaining": "The next experiment must identify uncovered source-specific work. Successor archive intake does not transfer this admission.", + "status": "reviewed", + "source_commit": "09dd0965711ca7eeb169057a420abab1c9052137", + "selected_record_sha256": "2a0220e866417774606e0f991e41b9c1d26b1f43b97857238cf478dbc7d330b5" + } + ] + }, + "scope_status": "refined", + "actual_scope": "Persistent successful-call restart of the exact encoded forward/inverse balanced CRT endpoints on one unchanged 79-role inventory, with changing geometry and per-role historical maxima.", + "scope_change_reason": "PR #7352 expressly leaves same-inventory restart open and charges 158 histories for a fresh pair. The new facade resolves that exact ownership boundary without changing numerical, encoded traversal or source-writing code.", + "bottleneck_link": "One source-relative owned_erasure/precision_tape interface; no full assumption discharge, payload caller or complete kappa improvement.", + "budget_minutes": 60, + "stop_rule": "Stop on new physical roles, forgotten historical backing, hidden old-capacity scans, changed numerical sources, exact predecessor overlap, or inability to retain the full source-cost envelope.", + "outcome": "partial", + "evidence": "PROOF.md; ten authenticated exports; author 174 whole calls/270 nodes/14 controls; separate root proof review and modular-inverse oracle over 32 calls/96 nodes; see REVIEW.md and independent/.", + "author": "Jerry Chen / CubeJerry", + "ai_assistance": "Substantial OpenAI assistance; independent AI source/proof review, not human or proof-kernel acceptance", + "open_questions": [ + { + "question": "Can one actual exceptional-key caller admit the persistent endpoint?", + "why_it_matters": "Private reuse does not supply source production, conversion, key transport or the raw compact macro.", + "first_step": "Pin the caller's actual input/output formats and charge its required source acquisitions and return path.", + "blocked_by": "No actual exceptional-key/payload caller is joined." + }, + { + "question": "Can the complete source closure be lowered to one literal binary program and tariff?", + "why_it_matters": "Source operations and backing bounds do not certify binary TM execution.", + "first_step": "Lower the fixed facade, then all inherited arithmetic/topology/owner and input preparation.", + "blocked_by": "Control refinement and complete binary program remain inherited." + }, + { + "question": "Can initially dirty histories be admitted when an actual caller needs them?", + "why_it_matters": "Local blank observations cannot certify arbitrary hidden tails.", + "first_step": "Specify an encoded historical frontier and a fully paid clean-up protocol.", + "blocked_by": "The current theorem requires supplied-clean initial tails and only successful linear use." + } + ], + "review_status": "independently_reviewed_source_relative" +} diff --git a/research/encoded-crt-restart/VALIDATION.json b/research/encoded-crt-restart/VALIDATION.json new file mode 100644 index 0000000000..401efc85f7 --- /dev/null +++ b/research/encoded-crt-restart/VALIDATION.json @@ -0,0 +1,46 @@ +{ + "status": "author_and_independent_checks_passed", + "python": "3.12.14", + "platform": "Linux-6.18.57-x86_64-with-glibc2.41", + "checks": [ + { + "command": [ + "/opt/codex/runtimes/codex-primary-runtime/dependencies/python/bin/python", + "-I", + "-W", + "error", + "-B", + "research/encoded-crt-restart/verify.py" + ], + "exit_code": 0, + "seconds": 22.186, + "stdout": "PASS_ENCODED_CRT_PERSISTENT_RESTART calls=174 nodes=270 roles=79 controls=14", + "stderr": "" + }, + { + "command": [ + "/opt/codex/runtimes/codex-primary-runtime/dependencies/python/bin/python", + "-I", + "-O", + "-W", + "error", + "-B", + "research/encoded-crt-restart/verify.py" + ], + "exit_code": 0, + "seconds": 22.946, + "stdout": "PASS_ENCODED_CRT_PERSISTENT_RESTART calls=174 nodes=270 roles=79 controls=14", + "stderr": "" + } + ], + "scientific_hashes": { + "restart.py": "462fd6f2a0bc0b5eaf5d74d2bda65b0c26ababbbafc06670e2a0cc9e46b5e7d6", + "checks.py": "43e88fd7426623b71fa33dfe4913d765cc4c7493d55a4c9bec8e34353636bb74", + "verify.py": "1d47929cd7bb04e3549b52176cca9b9f1fed2ebf1af064789121e7a0e901f20e", + "PROOF.md": "40d60f9894bcae292bd35b436efed1d6e53615d6a6782af9e8b6842da2e44772", + "EXPORT-PINS.json": "09269c4eb28c2eeacc4028e3ae0535e45d9cc22b237e9481f2f4b9e8ae1186d9", + "RESULT.json": "c0bf84329bb322ec9cc28bf76963b8a9e1d0e8244bc245f88cd4a805eb42f343" + }, + "limitations": "Independent review is recorded separately; these finite runs do not establish formal-kernel or human acceptance.", + "independent_review": "REVIEW.md" +} diff --git a/research/encoded-crt-restart/VERIFY.json b/research/encoded-crt-restart/VERIFY.json new file mode 100644 index 0000000000..f554ecd576 --- /dev/null +++ b/research/encoded-crt-restart/VERIFY.json @@ -0,0 +1,46 @@ +{ + "schema_version": 1, + "status": "ready", + "python": "3.12", + "requirements": [], + "inputs": [], + "commands": [ + { + "argv": [ + "{python}", + "-I", + "-W", + "error", + "-B", + "{package}/verify.py" + ], + "timeout_seconds": 180, + "checks": "Ten exact exports; 174 complete calls / 270 actual numerical nodes on persistent 79-role inventories; all padded pairs, changing shape/precision and translated origins; full histories, costs and 14 controls." + }, + { + "argv": [ + "{python}", + "-I", + "-O", + "-W", + "error", + "-B", + "{package}/verify.py" + ], + "timeout_seconds": 180, + "checks": "The same explicit source, semantic, history and lifecycle checks under optimized Python; exact frozen receipt." + }, + { + "argv": [ + "{python}", + "-I", + "-W", + "error", + "-B", + "{package}/independent/check.py" + ], + "timeout_seconds": 60, + "checks": "Separate modular-inverse CRT oracle: 32 complete calls/96 nodes; same physical roles, source preservation, full retirement and historical envelope." + } + ] +} diff --git a/research/encoded-crt-restart/checks.py b/research/encoded-crt-restart/checks.py new file mode 100644 index 0000000000..789ddff57d --- /dev/null +++ b/research/encoded-crt-restart/checks.py @@ -0,0 +1,187 @@ +"""Verifier support only: byte pins, fixtures and independent CRT arithmetic. + +None of the decoded values or schedules in this file enters production. +Prepared for CubeJerry with substantial OpenAI assistance. Apache-2.0. +""" +from contextlib import contextmanager +from hashlib import sha1, sha256 +from math import prod +from pathlib import Path +from types import ModuleType, SimpleNamespace +import json +import sys + +HERE = Path(__file__).resolve().parent + + +def need(ok, message): + if not ok: + raise ValueError(message) + + +def load(name, relative): + path = HERE / relative + module = ModuleType(name) + module.__file__ = str(path) + sys.modules[name] = module + exec(compile(path.read_bytes(), str(path), 'exec'), module.__dict__) + return module + + +def authenticate(): + pins = json.loads((HERE / 'EXPORT-PINS.json').read_text()) + for row in pins: + raw = (HERE / row['local']).read_bytes() + need(len(raw) == row['bytes'], 'exact source length') + need(sha256(raw).hexdigest() == row['sha256'], 'exact source SHA256') + need(sha1(b'blob ' + str(len(raw)).encode() + b'\0' + raw).hexdigest() + == row['git_blob'], 'exact source Git blob') + return len(pins) + + +def modules(): + root = 'predecessor/source/research/' + w = load('words', root + 'r437-preparation-composition/predecessor4025/source/words.py') + r = load('restart_records', root + 'r437-preparation-composition/predecessor4025/source/records.py') + e = load('restart_entry', root + 'encoded-crt-entry-lifecycle/entry.py') + n = load('restart_numeric', root + 'encoded-current-crt/producer.py') + o = load('restart_owner', root + 'crt-persistent-numerical-owner/owner.py') + c = load('restart_canonical', root + 'crt-mixed-row-entry/bridge.py') + f = load('restart_frontend', root + 'encoded-balanced-crt-entry/frontend.py') + writer = load('restart_writer', root + 'encoded-balanced-crt-endpoint/endpoint.py') + inv = load('restart_inverse', 'predecessor/inverse_frontend.py') + sub = load('restart_subtractive', 'predecessor/inverse_producer.py') + restart = load('restart', 'restart.py') + return SimpleNamespace(w=w, r=r, e=e, n=n, o=o, c=c, f=f, writer=writer, + inv=inv, sub=sub, restart=restart) + + +def acquire(m, ports=None, cls=None): + return (cls or m.restart.Restart)(m.w, m.r, m.e, m.n, m.o, m.c, + m.f, m.inv, m.sub, m.writer, ports) + + +class ShiftedCells: + """Test-only physical backing view with an opaque left prefix. + + The scientific code sees the same local cell indices. Every view has + one disjoint backing; no alias detection claim for arbitrary views. + """ + def __init__(self, raw, prefix): + self.origin = len(prefix) + self.data = bytearray(prefix) + bytearray(raw) + + def __len__(self): + return len(self.data) - self.origin + + def __getitem__(self, key): + if isinstance(key, slice): + return bytearray(self[i] for i in range(*key.indices(len(self)))) + if key < 0: + key += len(self) + return self.data[self.origin + key] + + def __setitem__(self, key, value): + if isinstance(key, slice): + start, stop, step = key.indices(len(self)) + need(step == 1 and stop-start == len(value), 'history-preserving fixture slice') + self.data[self.origin+start:self.origin+stop] = value + else: + if key < 0: + key += len(self) + self.data[self.origin + key] = value + + def append(self, value): + self.data.append(value) + + def __iter__(self): + return iter(self.data[self.origin:]) + + +def fixture(m, source, moduli, widths, values, tail=0): + """Admit new caller-supplied bytes without discarding source history.""" + raw, fields = bytearray([m.w.LEFT]), [] + for s, h, x in zip(moduli, widths, values, strict=True): + raw.append(m.r.ROOT) + raw.extend([m.w.ONE] * h) + raw.append(m.r.WORD_END) + for value, end in ((s, m.r.WORD_END), (x, m.r.RECORD_END)): + start = len(raw) + raw.extend((value >> j) & 1 for j in range(h)) + if end == m.r.RECORD_END: + fields.append(tuple(range(start, len(raw)))) + raw.append(end) + raw.append(m.w.RIGHT) + raw.extend((m.w.ONE, m.w.ZERO, m.w.BLANK)[j % 3] for j in range(tail)) + while len(source.cells) < len(raw): + source.cells.append(m.w.BLANK) + source.cells[:len(raw)] = raw + source.head = 1 + return fields + + +def values(source, fields): + return tuple(sum(source.cells[at] << j for j, at in enumerate(field)) + for field in fields) + + +def node_oracle(moduli, current, start, half, reverse): + """Defining congruences by exhaustive search, no producer arithmetic.""" + left, xs = moduli[start:start+half], current[start:start+half] + prefix, residues = 1, [] + for s, x in zip(left, xs): + residues.append(prefix*x % s) + prefix *= s + lower = 0 + if all(x < s for x, s in zip(xs, left)): + lower = next(k for k in range(prod(left)) + if all(k % s == residue for s, residue in zip(left, residues))) + out = list(current) + for i in range(start+half, start+2*half): + s, x = moduli[i], current[i] + offset = next(c for c in range(s) if (prefix*c-lower) % s == 0) + out[i] = ((x-offset if reverse else x+offset) % s) if x < s else x + prefix *= s + return tuple(out) + + +def schedule(d, reverse): + levels = range(1, d.bit_length()) + for j in reversed(tuple(levels)) if reverse else levels: + half = 1 << (j-1) + for start in range(0, d, 2*half): + yield start, half + + +def role_envelope(a, d): + p, length = a+1, 2+3*a+4*d + return ([p+1] + [2*a+2*d+2]*2 + [p+2]*57 + + [d*(p+2)+2]*3 + [p+2]*8 + [d+2]*6 + + [a+2, length]) + + +def actions(ports): + return sum(p.meter.reads+p.meter.writes+p.meter.moves for p in ports) + + +def blank(m, ports): + return all(p.head == 1 and all(x == m.w.BLANK for x in p.cells) for p in ports) + + +@contextmanager +def sealed(m): + old = m.e.Port.__init__, m.w.Word.__init__, m.w.Arena.__init__, m.w.Word.inspect + def denied(*_args, **_kwargs): + raise ValueError('new role or decoded word forbidden') + m.e.Port.__init__ = m.w.Word.__init__ = m.w.Arena.__init__ = m.w.Word.inspect = denied + try: + yield + finally: + m.e.Port.__init__, m.w.Word.__init__, m.w.Arena.__init__, m.w.Word.inspect = old + + +def poison(module): + def denied(*_args, **_kwargs): + raise ValueError('decoded runtime geometry forbidden') + for name in ('int', 'float', 'range', 'sum', 'min', 'max', 'enumerate', 'pow', 'sorted', 'zip'): + module.__dict__[name] = denied diff --git a/research/encoded-crt-restart/independent/RESULT.json b/research/encoded-crt-restart/independent/RESULT.json new file mode 100644 index 0000000000..deab1611fe --- /dev/null +++ b/research/encoded-crt-restart/independent/RESULT.json @@ -0,0 +1,9 @@ +{ + "calls": 32, + "nodes": 96, + "retained": 4172, + "roles": 79, + "source_sha256": "462fd6f2a0bc0b5eaf5d74d2bda65b0c26ababbbafc06670e2a0cc9e46b5e7d6", + "status": "PASS_INDEPENDENT_CRT_RESTART", + "checker_sha256": "b1ee3c980ef8f4eb5d8e964a8f3577c9ff59787450dfefcd06289b8246e75a44" +} diff --git a/research/encoded-crt-restart/independent/SOURCE-BINDINGS.json b/research/encoded-crt-restart/independent/SOURCE-BINDINGS.json new file mode 100644 index 0000000000..1fca9afe95 --- /dev/null +++ b/research/encoded-crt-restart/independent/SOURCE-BINDINGS.json @@ -0,0 +1,75 @@ +{ + "status": "PASS_SOURCE_COMMIT_AND_BYTES", + "files": [ + { + "path": "research/r437-preparation-composition/predecessor4025/source/words.py", + "commit": "e54523517d0f03e58352e647c403a5af3e525a57", + "blob": "8d4ba37e2778acb35b34e0719df2caf138fbeb50", + "bytes": 13794, + "status": "MATCH" + }, + { + "path": "research/r437-preparation-composition/predecessor4025/source/records.py", + "commit": "e54523517d0f03e58352e647c403a5af3e525a57", + "blob": "4f00467a0ff580954ad2fd0c7380240c753ddef3", + "bytes": 9888, + "status": "MATCH" + }, + { + "path": "research/encoded-crt-entry-lifecycle/entry.py", + "commit": "e54523517d0f03e58352e647c403a5af3e525a57", + "blob": "1fa2b0cb88320d4f5b623554bb0fc6de332b773c", + "bytes": 6377, + "status": "MATCH" + }, + { + "path": "research/encoded-current-crt/producer.py", + "commit": "e54523517d0f03e58352e647c403a5af3e525a57", + "blob": "a327b0161eca57a1cc44ec2aa8e3defed2167ddc", + "bytes": 7891, + "status": "MATCH" + }, + { + "path": "research/crt-persistent-numerical-owner/owner.py", + "commit": "e54523517d0f03e58352e647c403a5af3e525a57", + "blob": "20ef3519b6fef691ec92b7315e320b5e8ce9bf18", + "bytes": 2980, + "status": "MATCH" + }, + { + "path": "research/crt-mixed-row-entry/bridge.py", + "commit": "e54523517d0f03e58352e647c403a5af3e525a57", + "blob": "57f6853e262a6136bc616f1e47a31d0ace28495c", + "bytes": 3864, + "status": "MATCH" + }, + { + "path": "research/encoded-balanced-crt-entry/frontend.py", + "commit": "cc35ecedce6f208d5056fab6d17c58555affc73c", + "blob": "8adbe2cfef74da9854ed0b70b6c221f5746efa9f", + "bytes": 10737, + "status": "MATCH" + }, + { + "path": "research/encoded-balanced-crt-endpoint/endpoint.py", + "commit": "532b60ac427f47191175aba2e1317db0f3508d51", + "blob": "b084d893bdb2ce5571ef00196a9ec6a60e723964", + "bytes": 6038, + "status": "MATCH" + }, + { + "path": "research/encoded-balanced-crt-inverse/inverse_frontend.py", + "commit": "8c0e55c9ba25ff2c8199b01539a4d56ae71a1473", + "blob": "17abfb8500043bcdeb656094bb0213d911d986fc", + "bytes": 2167, + "status": "MATCH" + }, + { + "path": "research/encoded-balanced-crt-inverse/inverse_producer.py", + "commit": "8c0e55c9ba25ff2c8199b01539a4d56ae71a1473", + "blob": "46bf6ef4e2dfa53bca17ac668914b1a842eaba9e", + "bytes": 8041, + "status": "MATCH" + } + ] +} diff --git a/research/encoded-crt-restart/independent/check.py b/research/encoded-crt-restart/independent/check.py new file mode 100644 index 0000000000..ad5d59945c --- /dev/null +++ b/research/encoded-crt-restart/independent/check.py @@ -0,0 +1,75 @@ +"""Independent CRT arithmetic and persistent-history audit; Apache-2.0. +Prepared for CubeJerry with OpenAI assistance; no author verifier import. +""" +import hashlib,json,sys +from pathlib import Path +from types import ModuleType + +def module(name,path): + m=ModuleType(name);m.__file__=str(path);sys.modules[name]=m + exec(compile(path.read_bytes(),str(path),'exec'),m.__dict__);return m + +def load(root): + b=root/'predecessor/source/research' + paths=[('words',b/'r437-preparation-composition/predecessor4025/source/words.py'),('direct_records',b/'r437-preparation-composition/predecessor4025/source/records.py'),('direct_entry',b/'encoded-crt-entry-lifecycle/entry.py'),('direct_numeric',b/'encoded-current-crt/producer.py'),('direct_owner',b/'crt-persistent-numerical-owner/owner.py'),('direct_canonical',b/'crt-mixed-row-entry/bridge.py'),('direct_front',b/'encoded-balanced-crt-entry/frontend.py'),('direct_writer',b/'encoded-balanced-crt-endpoint/endpoint.py'),('direct_inverse',root/'predecessor/inverse_frontend.py'),('direct_subtractive',root/'predecessor/inverse_producer.py'),('direct_restart',root/'restart.py')] + return dict(zip(('w','r','e','n','o','c','f','wr','iv','sub','restart'),[module(*p) for p in paths])) + +def acquire(m): + return m['restart'].Restart(m['w'],m['r'],m['e'],m['n'],m['o'],m['c'],m['f'],m['iv'],m['sub'],m['wr']) + +def encode(m,source,mods,widths,values): + w,r=m['w'],m['r'];raw=[w.LEFT];positions=[] + for s,h,x in zip(mods,widths,values): + raw.extend([r.ROOT]+[w.ONE]*h+[r.WORD_END]);raw.extend(int(b) for b in reversed(format(s,f'0{h}b')));raw.append(r.WORD_END) + positions.append(tuple(range(len(raw),len(raw)+h)));raw.extend(int(b) for b in reversed(format(x,f'0{h}b')));raw.append(r.RECORD_END) + raw.extend([w.RIGHT,w.ONE,w.LEFT,w.RIGHT,w.ZERO,w.ONE]) + while len(source.cells)1 else Path(__file__).resolve().parents[1]).resolve();m=load(root);owner=acquire(m);source=m['e'].Port(m['w']) + ids=tuple(id(p.cells) for p in owner.ports);meters=tuple(id(p.meter) for p in owner.ports) + old=tuple(len(p.cells) for p in owner.ports);calls=nodes=largest=dmax=0 + def forbidden(*a,**k):raise AssertionError('fresh physical allocation') + m['e'].Port.__init__=m['w'].Word.__init__=m['w'].Arena.__init__=forbidden + shapes=[((3,5),(2,3)),((3,5,7,11),(3,3,3,4)),((3,5,7,11,13,17,19,23),(5,)*8),((3,7),(3,3))] + for k,(mods,widths) in enumerate(shapes): + for padded in (False,True): + x=tuple(((1<3*largest*dmax+74*largest+23*dmax+223:raise AssertionError('storage polynomial') + calls+=1;nodes+=len(mods)-1 + if current!=x:raise AssertionError('round trip') + print(json.dumps(dict(status='PASS_INDEPENDENT_CRT_RESTART',calls=calls,nodes=nodes,roles=len(ids),retained=sum(old),source_sha256=hashlib.sha256((root/'restart.py').read_bytes()).hexdigest()),sort_keys=True)) + +if __name__=='__main__':main() diff --git a/research/encoded-crt-restart/predecessor/inverse_frontend.py b/research/encoded-crt-restart/predecessor/inverse_frontend.py new file mode 100644 index 0000000000..17abfb8500 --- /dev/null +++ b/research/encoded-crt-restart/predecessor/inverse_frontend.py @@ -0,0 +1,52 @@ +"""Encoded descending balanced levels through the existing frontend hook. + +Prepared for Jerry Chen / CubeJerry with substantial OpenAI assistance. +Apache-2.0. See SEAMS.json for the exact inherited interface. +""" +from types import SimpleNamespace + + +def bind(forward): + """Bind one fixed provider; no geometry or numeric value is an argument.""" + class Iterator(forward.Iterator): + def __init__(self, words, records, entry, numeric, owner, canonical, source): + super().__init__(words, records, entry, numeric, owner, canonical, source) + # The inherited shape proof gives k depth tokens and half=1. + # Skip one token, then double once per remaining token: d/2. + depth = self.counters['depth'] + depth.step(1) + while depth.read() == self.w.ONE: + forward.Iterator._double_half(self) + depth.step(1) + self.w.need(depth.read() == self.w.RIGHT, 'complete reverse depth') + depth.rewind() + + def _double_half(self): + """Compatibility hook: the inherited next-level call now halves. + + Startup calls the base doubling method explicitly; every call + through this hook is a descending transition after a level ends. + """ + w = self.w + half = self.counters['half'] + temporary = self.counters['double'] + odd = False + while half.read() == w.ONE: + odd = not odd + if not odd: + temporary.append(w.ONE) + half.step(1) + w.need(half.read() == w.RIGHT and not odd, 'even reverse half size') + temporary.append(w.RIGHT) + temporary.rewind() + w.need(temporary.read() == w.ONE, 'nonempty next reverse half') + half.clear() + while temporary.read() == w.ONE: + half.append(w.ONE) + temporary.step(1) + w.need(temporary.read() == w.RIGHT, 'complete halved size') + half.append(w.RIGHT) + half.rewind() + temporary.clear() + + return SimpleNamespace(Iterator=Iterator) diff --git a/research/encoded-crt-restart/predecessor/inverse_producer.py b/research/encoded-crt-restart/predecessor/inverse_producer.py new file mode 100644 index 0000000000..46bf6ef4e2 --- /dev/null +++ b/research/encoded-crt-restart/predecessor/inverse_producer.py @@ -0,0 +1,174 @@ +# Inverse specialization for CubeJerry with OpenAI assistance. Apache-2.0. +# Exactly one scientific line differs from the pinned #5053 producer. +"""Encoded current-child CRT reconstruction and complete right-node update. + +JoyboyBrian, substantial OpenAI Codex assistance. Apache-2.0. +Only finite symbols/carries and fixed register ownership enter host control. +""" + +class Arithmetic: + """New loose-width residue interface; the frozen Ring guard is unchanged.""" + def __init__(self, arena, words): + self.arena, self.w = arena, words + self.raw = words.Unsigned(arena) + self.one = arena.literal(1) + + def admit(self, modulus): + self.w.need(self.raw.compare(modulus, self.one) > 0, 'CRT modulus exceeds one') + modulus.msb(); high = modulus.read(); modulus.rewind() + self.w.need(high == self.w.ZERO, 'CRT modulus high-bit margin') + + def remainder(self, value, modulus): + quotient, rest = self.raw.divmod(value, modulus) + self.arena.free(quotient) + return rest + + def add(self, left, right, modulus): + total, carry = self.raw.add(left, right) + self.w.need(not carry, 'modular addition margin') + if self.raw.compare(total, modulus) >= 0: + reduced = self.raw.subtract_exact(total, modulus) + self.arena.free(total); total = reduced + return total + + def subtract(self, left, right, modulus): + if self.raw.compare(left, right) >= 0: + return self.raw.subtract_exact(left, right) + larger, carry = self.raw.add(left, modulus) + self.w.need(not carry, 'modular subtraction margin') + result = self.raw.subtract_exact(larger, right) + self.arena.free(larger) + return result + + def multiply(self, left, right, modulus): + scan, result = self.arena.copy(right), self.arena.zero() + scan.msb() + while scan.read() != self.w.LEFT: + doubled = self.add(result, result, modulus) + self.arena.free(result); result = doubled + if scan.read() == self.w.ONE: + added = self.add(result, left, modulus) + self.arena.free(result); result = added + scan.step(-1) + scan.step(1); self.arena.free(scan) + return result + + def inverse(self, value, modulus): + r0, r1 = self.arena.copy(modulus), self.arena.copy(value) + t0, t1 = self.arena.zero(), self.arena.copy(self.one) + while not r1.zero(): + quotient, r2 = self.raw.divmod(r0, r1) + qmod = self.remainder(quotient, modulus) + product = self.multiply(qmod, t1, modulus) + t2 = self.subtract(t0, product, modulus) + self.arena.free_many(quotient, qmod, product, r0, t0) + r0, r1, t0, t1 = r1, r2, t1, t2 + unit = self.raw.compare(r0, self.one) == 0 + self.arena.free_many(r0, r1, t1) + if unit: return t0 + self.arena.free(t0) + return None + + def product(self, left, right): + scan, result = self.arena.copy(right), self.arena.zero() + scan.msb() + while scan.read() != self.w.LEFT: + doubled, carry = self.raw.add(result, result) + self.w.need(not carry, 'CRT product word capacity') + self.arena.free(result); result = doubled + if scan.read() == self.w.ONE: + added, carry = self.raw.add(result, left) + self.w.need(not carry, 'CRT product word capacity') + self.arena.free(result); result = added + scan.step(-1) + scan.step(1); self.arena.free(scan) + result.msb(); high = result.read(); result.rewind() + self.w.need(high == self.w.ZERO, 'CRT complete product high-bit margin') + return result + + +def produce(arena, left, right, words, records, *, fault=None): + """Both borrowed streams contain ROOT + two fixed-width words + RECORD_END. + + LEFT is unique at cell zero, RIGHT terminates the stream; heads enter at one. + Return owned lower/product words and (offset,new-value) records. The right + prefix includes all preceding right moduli, exactly as source balanced(). + """ + w = words + w.need(left is not right, 'distinct CRT descriptor roles') + protected = set(arena.live) + w.need(arena.capacity == 64 and arena.bits >= 4 and len(protected) <= 8, + 'fixed CRT numerical entry inventory') + output = records.Tape(); keep = set(); succeeded = False + + def pair(stream): + w.need(stream.read() == records.ROOT, 'CRT paired descriptor tag') + stream.step(1) + modulus = records.read_word(stream, arena) + value = records.read_word(stream, arena) + w.need(stream.read() == records.RECORD_END, 'CRT paired descriptor end') + stream.step(1) + return modulus, value + + try: + a = Arithmetic(arena, words) + lower, prefix = arena.zero(), arena.copy(a.one) + valid, seen_left = True, False + while left.read() != w.RIGHT: + seen_left = True + modulus, value = pair(left); a.admit(modulus) + valid = valid and a.raw.compare(value, modulus) < 0 + base = a.remainder(prefix, modulus) + inverse = a.inverse(base, modulus) + w.need(inverse is not None, 'pairwise coprime CRT prefix') + local = a.remainder(lower, modulus) + scaled = a.multiply(local, inverse, modulus) + digit = a.remainder(value, modulus) + adjustment = arena.copy(digit) if fault == 'treat_current_as_original' else a.subtract(digit, scaled, modulus) + term = a.product(prefix, adjustment) + updated, carry = a.raw.add(lower, term) + w.need(not carry, 'CRT reconstruction capacity') + total = a.product(prefix, modulus) + arena.free_many(modulus, value, base, inverse, local, scaled, digit, + adjustment, term, lower, prefix) + lower, prefix = updated, total + w.need(seen_left, 'nonempty current CRT left group') + if not valid: + arena.free(lower); lower = arena.zero() + left_product = arena.copy(prefix) + seen_right = False + while right.read() != w.RIGHT: + seen_right = True + modulus, value = pair(right); a.admit(modulus) + base = a.remainder(prefix, modulus) + inverse = a.inverse(base, modulus) + w.need(inverse is not None, 'pairwise coprime CRT right prefix') + local = a.remainder(lower, modulus) + offset = a.multiply(local, inverse, modulus) + if fault == 'omit_right_prefix': + arena.free(offset) + original_base = a.remainder(left_product, modulus) + original_inverse = a.inverse(original_base, modulus) + offset = a.multiply(local, original_inverse, modulus) + arena.free_many(original_base, original_inverse) + if a.raw.compare(value, modulus) < 0 or fault == 'rotate_padding': + canonical = a.remainder(value, modulus) + updated = a.subtract(canonical, offset, modulus) + arena.free(canonical) + else: updated = arena.copy(value) + output.append(records.ROOT) + records.append_word(output, offset); records.append_word(output, updated) + output.append(records.RECORD_END) + total = a.product(prefix, modulus) + arena.free_many(modulus, value, base, inverse, local, offset, updated, prefix) + prefix = total + w.need(seen_right, 'nonempty current CRT right group') + output.append(w.RIGHT); output.rewind() + keep = {lower.slot, left_product.slot}; succeeded = True + return dict(lower=lower, product=left_product, stream=output, left_valid=valid) + finally: + left.rewind(); right.rewind() + for slot in tuple(arena.live): + if slot not in protected and slot not in keep: + arena.free(arena.words[slot]) + if not succeeded: output.clear() diff --git a/research/encoded-crt-restart/predecessor/source/research/crt-mixed-row-entry/bridge.py b/research/encoded-crt-restart/predecessor/source/research/crt-mixed-row-entry/bridge.py new file mode 100644 index 0000000000..57f6853e26 --- /dev/null +++ b/research/encoded-crt-restart/predecessor/source/research/crt-mixed-row-entry/bridge.py @@ -0,0 +1,93 @@ +"""Produce CRT entry streams from declared padded axis records. + +Ali Romman with substantial OpenAI Codex assistance. Apache-2.0. +""" + + +def canonical_end(target, words, records): + """Remove high zero bits by local moves. Keep one bit for zero.""" + target.step(-1) + while target.read() == words.ZERO: + target.write(words.BLANK) + target.step(-1) + if target.read() in (records.ROOT, records.WORD_END): + target.step(1) + target.append(words.ZERO) + else: + words.need(target.read() == words.ONE, 'last nonzero bit') + target.step(1) + target.append(records.WORD_END) + + +class RowEntry: + """The topology is compile-time data. Axis fields stay on tapes.""" + + def __init__(self, words, records, entry, producer, source, dirty, + widths, ell, level, start, global_row): + w, r = words, records + d = len(widths) + w.need(d >= 2 and d & (d - 1) == 0, 'power-of-two axis count') + w.need(type(ell) is int and ell >= 2, 'compiled ell') + w.need(all(type(h) is int and h in (ell - 1, ell) for h in widths), + 'compiled width family') + w.need(type(level) is int and 1 <= level < d.bit_length(), 'compiled level') + size = 1 << level + w.need(type(start) is int and 0 <= start <= d - size and start % size == 0, + 'compiled tree node') + w.need(type(global_row) is int and 0 <= global_row < 2 * ell - 1, + 'compiled global row') + middle, stop = start + size // 2, start + size + self.active = tuple(i for i in range(middle, stop) + if widths[i] == ell or global_row not in (ell - 1, ell)) + w.need(len(dirty) == 8 and len({id(x) for x in (source, *dirty)}) == 9, + 'distinct source and dirty roles') + self.w, self.r = w, r + self.context, self.result, self.inputs = None, None, () + if not self.active: + return + self.guide, self.left, self.right = (entry.Port(w) for _ in range(3)) + self.inputs = (self.guide, self.left, self.right) + for axis, h in enumerate(widths): + selected = start <= axis < stop + target = self.left if axis < middle else self.right + w.need(source.read() == r.ROOT, 'axis record tag') + source.step(1) + if selected: + target.append(r.ROOT) + for _ in range(h): + w.need(source.read() == w.ONE, 'declared unary width') + source.step(1) + if selected: + self.guide.append(w.ONE) + w.need(source.read() == r.WORD_END, 'width delimiter') + source.step(1) + for delimiter in (r.WORD_END, r.RECORD_END): + for _ in range(h): + bit = source.read() + w.need(bit in (w.ZERO, w.ONE), 'declared padded field') + source.step(1) + if selected: + target.append(bit) + w.need(source.read() == delimiter, 'axis field delimiter') + source.step(1) + if selected: + canonical_end(target, w, r) + if selected: + target.append(r.RECORD_END) + w.need(source.read() == w.RIGHT, 'complete axis stream') + source.rewind() + self.guide.append(w.ONE) + self.guide.rewind() + for target in (self.left, self.right): + target.append(w.RIGHT) + target.rewind() + self.context = entry.Entry(w, r, self.guide, dirty) + self.result = self.context.invoke(producer, self.left, self.right) + + def close(self): + if self.context is None: + return + self.context.consume(self.result) + self.context.close() + for port in self.inputs: + port.retire() diff --git a/research/encoded-crt-restart/predecessor/source/research/crt-persistent-numerical-owner/owner.py b/research/encoded-crt-restart/predecessor/source/research/crt-persistent-numerical-owner/owner.py new file mode 100644 index 0000000000..20ef3519b6 --- /dev/null +++ b/research/encoded-crt-restart/predecessor/source/research/crt-persistent-numerical-owner/owner.py @@ -0,0 +1,77 @@ +"""One physical63-role owner for the unchanged numerical CRT RowEntry. +JoyboyBrian, substantial OpenAI Codex assistance. Apache-2.0. +""" +from types import SimpleNamespace + + +class Bank: + def __init__(self, words, entry, ports=None): + self.w, self.entry = words, entry + # Physical allocation belongs only to initial owner acquisition. + if ports is None: + ports = [entry.Port(words) for _ in range(63)] + for port in ports: + port.retire() + words.need(len(ports) == 63 and len({id(p.cells) for p in ports}) == 63, + '63 distinct owned backing roles') + self.ports = tuple(ports) + self.busy = False + self.cursor = 0 + + def take(self, words): + words.need(words is self.w and self.busy and self.cursor < 63, + 'fixed live owner role') + port = self.ports[self.cursor] + self.cursor += 1 + words.need(port.head == 1 and port.read() == words.BLANK, + 'retired role head and body') + port.step(-1) + words.need(port.read() == words.BLANK, 'retired marker') + port.write(words.LEFT) + port.step(1) + return port + + def open(self, records, producer, bridge, source, dirty, + widths, ell, level, start, row): + self.w.need(not self.busy, 'previous result must retire first') + self.w.need(not ({id(p.cells) for p in self.ports} & + {id(p.cells) for p in (source, *dirty)}), + 'borrowed backing disjoint from owner') + self.busy, self.cursor = True, 0 + bank = self + + class Reentry(self.entry.Entry): + def new_port(self): + port = bank.take(self.w) + self.owned.append(port) + self.control += 1 + return port + + adapter = SimpleNamespace(Port=self.take, Entry=Reentry) + actual = bridge.RowEntry(self.w, records, adapter, producer, source, + dirty, widths, ell, level, start, row) + self.w.need(self.cursor == (63 if actual.active else 0), + 'complete fixed role acquisition') + return Lease(self, actual) + + def release(self): + self.w.need(self.busy, 'live bank') + # Fixed-role checks are paid local observations, never tail truncation. + for port in self.ports[:self.cursor]: + self.w.need(port.head == 1 and port.read() == self.w.BLANK, + 'retired numerical body') + port.step(-1) + self.w.need(port.read() == self.w.BLANK, 'retired owned marker') + port.step(1) + self.busy = False + + +class Lease: + def __init__(self, bank, actual): + self.bank, self.actual, self.closed = bank, actual, False + + def close(self): + self.bank.w.need(not self.closed, 'single row result retirement') + self.actual.close() + self.bank.release() + self.closed = True diff --git a/research/encoded-crt-restart/predecessor/source/research/encoded-balanced-crt-endpoint/endpoint.py b/research/encoded-crt-restart/predecessor/source/research/encoded-balanced-crt-endpoint/endpoint.py new file mode 100644 index 0000000000..b084d893bd --- /dev/null +++ b/research/encoded-crt-restart/predecessor/source/research/encoded-balanced-crt-endpoint/endpoint.py @@ -0,0 +1,157 @@ +"""Paid whole-node CRT result projection into the actual encoded source. + +Prepared for Jerry Chen / CubeJerry with substantial OpenAI assistance. +Apache-2.0. The fixed predecessor providers are pinned in INPUT-PINS.json. +No coordinate, modulus, width, level or axis count enters host control. +""" + + +class Endpoint: + """One encoded forward balanced address-state traversal, 79 owned roles.""" + + def __init__(self, frontend, words, records, entry, numeric, owner, + canonical, source): + self.w, self.r, self.source = words, records, source + self.iterator = frontend.Iterator(words, records, entry, numeric, + owner, canonical, source) + self.staging = entry.Port(words) + self.staging.retire() + self.pending = False + + def _copy(self, expected): + w = self.w + w.need(self.source.read() == expected, 'preserved source delimiter') + self.staging.append(expected) + self.source.step(1) + + def _field(self, width): + w = self.w + while width.read() == w.ONE: + bit = self.source.read() + w.need(bit in (w.ZERO, w.ONE), 'source padded bit') + self.staging.append(bit) + self.source.step(1) + width.step(1) + w.need(width.read() == w.RIGHT, 'source width extent') + width.rewind() + + def _updated(self, width, result, guide): + w, r = self.w, self.r + w.need(result.read() == r.ROOT, 'whole-node result record') + result.step(1) + while guide.read() == w.ONE: + w.need(result.read() in (w.ZERO, w.ONE), 'offset bit') + result.step(1) + guide.step(1) + w.need(guide.read() == w.BLANK and result.read() == r.WORD_END, + 'whole offset consumed') + result.step(1) + guide.rewind() + while width.read() == w.ONE: + old, new = self.source.read(), result.read() + w.need(old in (w.ZERO, w.ONE) and new in (w.ZERO, w.ONE), + 'current and updated coordinate bits') + w.need(guide.read() == w.ONE, 'updated field covers source width') + self.staging.append(new) + self.source.step(1) + result.step(1) + width.step(1) + guide.step(1) + w.need(width.read() == w.RIGHT, 'updated source width') + width.rewind() + while guide.read() == w.ONE: + w.need(result.read() == w.ZERO, 'updated value fits declared width') + result.step(1) + guide.step(1) + w.need(guide.read() == w.BLANK and result.read() == r.WORD_END, + 'complete updated field') + result.step(1) + guide.rewind() + w.need(result.read() == r.RECORD_END, 'whole-node result end') + result.step(1) + + def _record(self, result=None, guide=None): + w, r = self.w, self.r + width = self.iterator.counters['width'] + self._copy(r.ROOT) + seen = False + while self.source.read() == w.ONE: + seen = True + self.staging.append(w.ONE) + width.append(w.ONE) + self.source.step(1) + w.need(seen, 'positive source width') + self._copy(r.WORD_END) + width.append(w.RIGHT) + width.rewind() + self._field(width) + self._copy(r.WORD_END) + if result is None: + self._field(width) + else: + self._updated(width, result, guide) + self._copy(r.RECORD_END) + width.clear() + + def stage(self, lease): + """Snapshot the next complete source while its numerical lease is live.""" + w, r, it = self.w, self.r, self.iterator + w.need(it.live and not self.pending, 'one live unstaged node result') + self.staging.step(-1) + w.need(self.staging.read() == w.BLANK, 'retired staging origin') + self.staging.write(w.LEFT) + self.staging.step(1) + axis, half = it.counters['axis'], it.counters['half'] + result, guide = lease.actual.result['stream'], lease.actual.guide + while axis.read() != r.STEP: + w.need(axis.read() == w.ONE, 'current node prefix') + self._record() + axis.step(1) + for selected in (False, True): + while half.read() == w.ONE: + w.need(axis.read() in (w.ONE, r.STEP), 'complete current node') + self._record(result if selected else None, guide) + axis.step(1) + half.step(1) + w.need(half.read() == w.RIGHT, 'current node half extent') + half.rewind() + w.need(result.read() == w.RIGHT, 'all right-coordinate results consumed') + while self.source.read() != w.RIGHT: + w.need(axis.read() in (w.ONE, r.VALUE), 'unchanged source suffix') + self._record() + axis.step(1) + w.need(axis.read() == w.RIGHT, 'complete source and cursor extents') + self.staging.append(w.RIGHT) + self.staging.rewind() + self.source.rewind() + axis.rewind() + result.rewind() + self.pending = True + + def commit(self): + """After retirement, overwrite equal-length source and erase the copy.""" + w, it = self.w, self.iterator + w.need(self.pending and not it.live and not it.bank.busy, + 'source update follows numerical retirement') + while self.staging.read() != w.RIGHT: + self.source.write(self.staging.read()) + self.source.step(1) + self.staging.step(1) + w.need(self.source.read() == w.RIGHT, 'preserved full source extent') + self.source.rewind() + self.staging.retire() + self.pending = False + + def step(self): + self.w.need(not self.pending, 'previous staged update must commit') + lease = self.iterator.next() + if lease is None: + return False + self.stage(lease) + lease.close() + self.commit() + return True + + def run(self): + while self.step(): + pass diff --git a/research/encoded-crt-restart/predecessor/source/research/encoded-balanced-crt-entry/frontend.py b/research/encoded-crt-restart/predecessor/source/research/encoded-balanced-crt-entry/frontend.py new file mode 100644 index 0000000000..8adbe2cfef --- /dev/null +++ b/research/encoded-crt-restart/predecessor/source/research/encoded-balanced-crt-entry/frontend.py @@ -0,0 +1,277 @@ +"""Tape-driven balanced-node selection into the unchanged CRT numerical entry. + +No runtime width, axis count, start, level or precision is decoded. All variable +iteration is driven by local symbols on the supplied source or owned unary +tapes. Numeric arithmetic and its 63-role bank are pinned predecessor code. +Prepared for CubeJerry with substantial OpenAI assistance. Apache-2.0. +""" +from types import SimpleNamespace + + +COUNTERS = ('axis', 'depth', 'halve_a', 'halve_b', 'half', 'double', 'width') +GUARDS = ('g0', 'g1', 'g2', 'g3', 'g4', 'g5', 'g6', 'g7') + + +class Iterator: + """One numerical result at a time; source contents stay read-only. + +The supplied source has the #5353 tagged padded-axis encoding and enters at +head one. Construction charges shape manufacture. next() takes no geometry +arguments. The physical interface is linear-use: consume the current lease +once before the next result and relinquish its borrowed aliases. Historical +Python-handle identity checks are interpreter guards, not a tape service. +""" + def __init__(self, words, records, entry, numeric, owner, canonical, source): + self.w, self.r, self.e = words, records, entry + self.numeric, self.canonical, self.source = numeric, canonical, source + self.bank = owner.Bank(words, entry) + self.guards = tuple(entry.Port(words) for _ in GUARDS) + for port in self.guards: + port.retire() + self.counters = {name: entry.Port(words) for name in COUNTERS} + self.live, self.closed = False, False + try: + self._shape() + except ValueError: + # Source framing errors and nondyadic counts precede numerical entry. + source.rewind() + for port in self.counters.values(): + port.retire() + self.closed = True + raise + + def _record(self, target=None, guide=None): + """Read one exact axis record; optionally project its canonical pair.""" + w, r, source = self.w, self.r, self.source + width = self.counters['width'] + width.clear() + w.need(source.read() == r.ROOT, 'axis tag') + source.step(1) + if target is not None: + target.append(r.ROOT) + seen = False + while source.read() == w.ONE: + seen = True + width.append(w.ONE) + if guide is not None: + guide.append(w.ONE) + source.step(1) + w.need(seen and source.read() == r.WORD_END, 'positive unary width') + source.step(1) + width.append(w.RIGHT) + width.rewind() + for delimiter in (r.WORD_END, r.RECORD_END): + while width.read() == w.ONE: + bit = source.read() + w.need(bit in (w.ZERO, w.ONE), 'padded source bit') + if target is not None: + target.append(bit) + source.step(1) + width.step(1) + w.need(width.read() == w.RIGHT and source.read() == delimiter, + 'exact source field extent') + source.step(1) + width.rewind() + if target is not None: + self.canonical.canonical_end(target, w, r) + if target is not None: + target.append(r.RECORD_END) + width.clear() + + def _many(self, port): + w = self.w + w.need(port.read() == w.ONE, 'nonempty reduction count') + port.step(1) + symbol = port.read() + w.need(symbol in (w.ONE, w.RIGHT), 'unary reduction shape') + port.rewind() + return symbol == w.ONE + + def _shape(self): + w, source = self.w, self.source + axis, depth = self.counters['axis'], self.counters['depth'] + current, spare = self.counters['halve_a'], self.counters['halve_b'] + while source.read() != w.RIGHT: + self._record() + axis.append(w.ONE) + current.append(w.ONE) + source.rewind() + axis.append(w.RIGHT) + axis.rewind() + current.append(w.RIGHT) + current.rewind() + w.need(self._many(current), 'at least two source axes') + while self._many(current): + depth.append(w.ONE) + odd = False + while current.read() == w.ONE: + odd = not odd + if not odd: + spare.append(w.ONE) + current.step(1) + w.need(current.read() == w.RIGHT and not odd, 'dyadic source axis count') + spare.append(w.RIGHT) + spare.rewind() + current.clear() + current, spare = spare, current + current.clear() + spare.clear() + depth.append(w.RIGHT) + depth.rewind() + half = self.counters['half'] + half.append(w.ONE) + half.append(w.RIGHT) + half.rewind() + w.need(axis.read() == w.ONE, 'first axis') + axis.write(self.r.STEP) # Unique current-node marker. + + def _prepare_guards(self, guide): + w = self.w + for port in self.guards: + port.step(-1) + w.need(port.read() == w.BLANK, 'retired protected marker') + port.write(w.LEFT) + port.step(1) + while guide.read() == w.ONE: + w.need(port.read() == w.BLANK, 'retired protected body') + port.write(w.ZERO) + port.step(1) + guide.step(1) + w.need(guide.read() == w.BLANK and port.read() == w.BLANK, + 'current protected extent') + port.write(w.RIGHT) + port.rewind() + guide.rewind() + + def _entry(self, w, r, adapter, numeric, source, dirty, + widths, ell, level, start, row): + # Bank.open's fixed call signature is preserved. Geometry is never supplied. + w.need(widths is None and ell is None and level is None and + start is None and row is None, 'no host geometry arguments') + w.need(source is self.source and dirty is self.guards, 'actual borrowed ports') + return NodeEntry(self, adapter) + + def next(self): + self.w.need(not self.live, 'previous node result must close') + if self.closed: + return None + self.w.need(self.counters['depth'].read() == self.w.ONE, 'active encoded level') + self.live = True + bridge = SimpleNamespace(RowEntry=self._entry) + lease = self.bank.open(self.r, self.numeric, bridge, self.source, self.guards, + None, None, None, None, None) + return NodeLease(self, lease) + + def _double_half(self): + w = self.w + half, temporary = self.counters['half'], self.counters['double'] + while half.read() == w.ONE: + temporary.append(w.ONE) + half.step(1) + w.need(half.read() == w.RIGHT, 'half-size delimiter') + half.write(w.BLANK) + temporary.append(w.RIGHT) + temporary.rewind() + while temporary.read() == w.ONE: + half.append(w.ONE) + temporary.step(1) + w.need(temporary.read() == w.RIGHT, 'copied half size') + half.append(w.RIGHT) + half.rewind() + temporary.clear() + + def _advance(self, last): + w, r = self.w, self.r + axis, depth = self.counters['axis'], self.counters['depth'] + while axis.read() != r.STEP: + w.need(axis.read() == w.ONE, 'preserved current cursor') + axis.step(1) + axis.write(w.ONE) + if last: + while axis.read() != w.RIGHT: + w.need(axis.read() == w.ONE, 'last-node suffix') + axis.step(1) + axis.rewind() + depth.step(1) + if depth.read() == w.RIGHT: + self.close() + return + w.need(depth.read() == w.ONE, 'next encoded level') + self._double_half() + axis.write(r.STEP) + else: + while axis.read() != r.VALUE: + w.need(axis.read() == w.ONE, 'next-node interval') + axis.step(1) + axis.write(r.STEP) + axis.rewind() + + def close(self): + self.w.need(not self.live and not self.closed, 'retired iterator closes once') + for port in self.counters.values(): + port.retire() + self.closed = True + + +class NodeEntry: + """Actual canonical streams and precision guide into unchanged Entry.""" + def __init__(self, iterator, adapter): + self.iterator = iterator + w, r, source = iterator.w, iterator.r, iterator.source + self.guide, self.left, self.right = (adapter.Port(w), adapter.Port(w), adapter.Port(w)) + self.inputs = (self.guide, self.left, self.right) + self.active = True + axis, half = iterator.counters['axis'], iterator.counters['half'] + while axis.read() != r.STEP: + w.need(axis.read() == w.ONE, 'prefix cursor') + iterator._record() + axis.step(1) + for target in (self.left, self.right): + while half.read() == w.ONE: + w.need(axis.read() in (w.ONE, r.STEP), 'complete selected node') + iterator._record(target, self.guide) + axis.step(1) + half.step(1) + w.need(half.read() == w.RIGHT, 'encoded half extent') + half.rewind() + target.append(w.RIGHT) + target.rewind() + self.last = axis.read() == w.RIGHT + if not self.last: + w.need(axis.read() == w.ONE, 'following source axis') + axis.write(r.VALUE) # Pending next cursor; current cursor survives handoff. + axis.rewind() + source.rewind() + self.guide.append(w.ONE) + self.guide.rewind() + iterator._prepare_guards(self.guide) + self.context = adapter.Entry(w, r, self.guide, iterator.guards) + self.result = self.context.invoke(iterator.numeric, self.left, self.right) + + def close(self): + self.context.consume(self.result) + self.context.close() + for port in self.inputs: + port.retire() + for port in self.iterator.guards: + port.retire() + + +class NodeLease: + """Interpreter wrapper for the single current linear-use continuation. + +The closed flag also guards stale Python references, but the fixed-role +physical theorem does not implement an unbounded stale-handle history. +""" + def __init__(self, iterator, lease): + self.iterator, self.lease = iterator, lease + self.actual = lease.actual + self.closed = False + + def close(self): + self.iterator.w.need(not self.closed, 'node lease closes once') + last = self.actual.last + self.lease.close() + self.closed = True + self.iterator.live = False + self.iterator._advance(last) diff --git a/research/encoded-crt-restart/predecessor/source/research/encoded-crt-entry-lifecycle/entry.py b/research/encoded-crt-restart/predecessor/source/research/encoded-crt-entry-lifecycle/entry.py new file mode 100644 index 0000000000..1fa2b0cb88 --- /dev/null +++ b/research/encoded-crt-restart/predecessor/source/research/encoded-crt-entry-lifecycle/entry.py @@ -0,0 +1,117 @@ +"""Guide-driven CRT numerical entry; no host width or bulk word constructor. +JoyboyBrian with substantial OpenAI Codex assistance. Apache-2.0. +""" +from types import SimpleNamespace + +class Port: + def __init__(self,w): + self.w=w;self.cells=bytearray([w.BLANK]);self.head=0;self.meter=w.Meter() + self.write(w.LEFT);self.step(1) + def read(self): + self.meter.reads+=1 + return self.cells[self.head] if self.head=0,'unit local movement') + self.head+=d;self.meter.moves+=1 + def append(self,v): + self.w.need(self.read()==self.w.BLANK,'append blank');self.write(v);self.step(1) + def rewind(self): + self.step(-1) + while self.read()!=self.w.LEFT:self.step(-1) + self.step(1) + def clear(self): + self.rewind() + while self.read()!=self.w.BLANK:self.write(self.w.BLANK);self.step(1) + self.rewind() + def retire(self): + self.clear();self.step(-1);self.write(self.w.BLANK);self.step(1) + +class Extent: + """An encoded width value. Only the source's literal >=4 observation exists.""" + def __init__(self,guide,w):self.guide,self.w=guide,w + def __ge__(self,constant): + self.w.need(type(constant) is int and constant==4,'audited width observation') + good=True;g=self.guide + for _ in range(4): + if g.read()!=self.w.ONE:good=False;break + g.step(1) + g.rewind();return good + def __int__(self):raise ValueError('runtime width decode forbidden') + +class Entry: + def __init__(self,w,r,guide,dirty): + w.need(len(dirty)==8 and len({id(x) for x in [guide,*dirty]})==9,'eight distinct dirty ports') + self.w,self.r,self.guide,self.dirty=w,r,guide,tuple(dirty);self.owned=[];self.control=0;self.closed=False + width=Extent(guide,w);w.need(width>=4,'encoded width at least four') + a=object.__new__(w.Arena);a.bits=width;a.capacity=64;a.meter=w.Meter() + a.words=[];a.available=list(reversed(range(8,64)));a.live=set(range(8));self.arena=a + class HostedWord(w.Word): + @property + def cells(self):return self.port.cells + @property + def head(self):return self.port.head + @head.setter + def head(self,value):self.port.head=value + def wrap(port,slot): + word=object.__new__(HostedWord);word.arena=a;word.slot=slot;word.port=port;return word + for slot in range(64): + self.control+=1 + if slot<8:port=dirty[slot] + else:port=self.word_storage(False) + a.words.append(wrap(port,slot)) + a.template=wrap(self.word_storage(True),-1) + self.left,self.right,self.output=(self.new_port() for _ in range(3));self.output_taken=False + def new_port(self): + p=Port(self.w);self.owned.append(p);self.control+=1;return p + def word_storage(self,template): + p=self.new_port();g=self.guide;w=self.w + while g.read()==w.ONE:p.write(w.ZERO if template else w.BLANK);p.step(1);g.step(1) + w.need(g.read()==w.BLANK,'unary width guide');g.rewind() + p.write(w.RIGHT if template else w.BLANK);p.rewind();return p + def pad(self,source,target): + w,r,g=self.w,self.r,self.guide + while source.read()!=w.RIGHT: + w.need(source.read()==r.ROOT,'paired canonical tag');target.append(r.ROOT);source.step(1) + for _ in range(2): + seen=False;many=False;last=w.ZERO;ended=False + while g.read()==w.ONE: + if source.read()==r.WORD_END:ended=True + if ended:target.append(w.ZERO) + else: + bit=source.read();w.need(bit in (w.ZERO,w.ONE),'canonical bit') + many=seen;seen=True;last=bit;target.append(bit);source.step(1) + g.step(1) + w.need(g.read()==w.BLANK,'unary guide');g.rewind() + w.need(source.read()==r.WORD_END and seen and (last==w.ONE or not many),'canonical word fits width') + source.step(1);target.append(r.WORD_END) + w.need(source.read()==r.RECORD_END,'paired canonical end');source.step(1);target.append(r.RECORD_END) + target.append(w.RIGHT);target.rewind();source.rewind() + def output_factory(self): + self.w.need(not self.output_taken,'one output stream role');self.output_taken=True;return self.output + def invoke(self,producer,left,right): + self.w.need(not self.closed,'live context');self.pad(left,self.left);self.pad(right,self.right) + proxy=SimpleNamespace(**{n:getattr(self.r,n) for n in ('ROOT','RECORD_END','WORD_END','read_word','append_word')},Tape=self.output_factory) + old=self.w.Word.__init__;old_arena=self.w.Arena.__init__;inspect=self.w.Word.inspect + def forbidden(*args,**kwargs):raise ValueError('scientific host constructor/decode forbidden') + self.w.Word.__init__=forbidden;self.w.Arena.__init__=forbidden;self.w.Word.inspect=forbidden + try:return producer.produce(self.arena,self.left,self.right,self.w,proxy) + finally:self.w.Word.__init__=old;self.w.Arena.__init__=old_arena;self.w.Word.inspect=inspect + def consume(self,result): + self.arena.free_many(result['lower'],result['product']);result['stream'].clear() + self.left.clear();self.right.clear();self.output_taken=False + def close(self): + w=self.w;w.need(not self.closed and self.arena.live==set(range(8)),'terminal numerical owners') + # Retained private word backing is blank after free; remove its marker. + for word in self.arena.words[8:]: + word.rewind();w.need(word.read()==w.BLANK,'retired word body');word.step(-1) + # Word.write forbids LEFT/marker changes: the owned setup port performs this paid write. + port=word.port;port.write(w.BLANK);port.step(1) + self.arena.template.erase() + template=self.arena.template.port + template.step(-1);template.write(w.BLANK);template.step(1) + for p in (self.left,self.right,self.output):p.retire() + self.closed=True diff --git a/research/encoded-crt-restart/predecessor/source/research/encoded-current-crt/producer.py b/research/encoded-crt-restart/predecessor/source/research/encoded-current-crt/producer.py new file mode 100644 index 0000000000..a327b0161e --- /dev/null +++ b/research/encoded-crt-restart/predecessor/source/research/encoded-current-crt/producer.py @@ -0,0 +1,172 @@ +"""Encoded current-child CRT reconstruction and complete right-node update. + +JoyboyBrian, substantial OpenAI Codex assistance. Apache-2.0. +Only finite symbols/carries and fixed register ownership enter host control. +""" + +class Arithmetic: + """New loose-width residue interface; the frozen Ring guard is unchanged.""" + def __init__(self, arena, words): + self.arena, self.w = arena, words + self.raw = words.Unsigned(arena) + self.one = arena.literal(1) + + def admit(self, modulus): + self.w.need(self.raw.compare(modulus, self.one) > 0, 'CRT modulus exceeds one') + modulus.msb(); high = modulus.read(); modulus.rewind() + self.w.need(high == self.w.ZERO, 'CRT modulus high-bit margin') + + def remainder(self, value, modulus): + quotient, rest = self.raw.divmod(value, modulus) + self.arena.free(quotient) + return rest + + def add(self, left, right, modulus): + total, carry = self.raw.add(left, right) + self.w.need(not carry, 'modular addition margin') + if self.raw.compare(total, modulus) >= 0: + reduced = self.raw.subtract_exact(total, modulus) + self.arena.free(total); total = reduced + return total + + def subtract(self, left, right, modulus): + if self.raw.compare(left, right) >= 0: + return self.raw.subtract_exact(left, right) + larger, carry = self.raw.add(left, modulus) + self.w.need(not carry, 'modular subtraction margin') + result = self.raw.subtract_exact(larger, right) + self.arena.free(larger) + return result + + def multiply(self, left, right, modulus): + scan, result = self.arena.copy(right), self.arena.zero() + scan.msb() + while scan.read() != self.w.LEFT: + doubled = self.add(result, result, modulus) + self.arena.free(result); result = doubled + if scan.read() == self.w.ONE: + added = self.add(result, left, modulus) + self.arena.free(result); result = added + scan.step(-1) + scan.step(1); self.arena.free(scan) + return result + + def inverse(self, value, modulus): + r0, r1 = self.arena.copy(modulus), self.arena.copy(value) + t0, t1 = self.arena.zero(), self.arena.copy(self.one) + while not r1.zero(): + quotient, r2 = self.raw.divmod(r0, r1) + qmod = self.remainder(quotient, modulus) + product = self.multiply(qmod, t1, modulus) + t2 = self.subtract(t0, product, modulus) + self.arena.free_many(quotient, qmod, product, r0, t0) + r0, r1, t0, t1 = r1, r2, t1, t2 + unit = self.raw.compare(r0, self.one) == 0 + self.arena.free_many(r0, r1, t1) + if unit: return t0 + self.arena.free(t0) + return None + + def product(self, left, right): + scan, result = self.arena.copy(right), self.arena.zero() + scan.msb() + while scan.read() != self.w.LEFT: + doubled, carry = self.raw.add(result, result) + self.w.need(not carry, 'CRT product word capacity') + self.arena.free(result); result = doubled + if scan.read() == self.w.ONE: + added, carry = self.raw.add(result, left) + self.w.need(not carry, 'CRT product word capacity') + self.arena.free(result); result = added + scan.step(-1) + scan.step(1); self.arena.free(scan) + result.msb(); high = result.read(); result.rewind() + self.w.need(high == self.w.ZERO, 'CRT complete product high-bit margin') + return result + + +def produce(arena, left, right, words, records, *, fault=None): + """Both borrowed streams contain ROOT + two fixed-width words + RECORD_END. + + LEFT is unique at cell zero, RIGHT terminates the stream; heads enter at one. + Return owned lower/product words and (offset,new-value) records. The right + prefix includes all preceding right moduli, exactly as source balanced(). + """ + w = words + w.need(left is not right, 'distinct CRT descriptor roles') + protected = set(arena.live) + w.need(arena.capacity == 64 and arena.bits >= 4 and len(protected) <= 8, + 'fixed CRT numerical entry inventory') + output = records.Tape(); keep = set(); succeeded = False + + def pair(stream): + w.need(stream.read() == records.ROOT, 'CRT paired descriptor tag') + stream.step(1) + modulus = records.read_word(stream, arena) + value = records.read_word(stream, arena) + w.need(stream.read() == records.RECORD_END, 'CRT paired descriptor end') + stream.step(1) + return modulus, value + + try: + a = Arithmetic(arena, words) + lower, prefix = arena.zero(), arena.copy(a.one) + valid, seen_left = True, False + while left.read() != w.RIGHT: + seen_left = True + modulus, value = pair(left); a.admit(modulus) + valid = valid and a.raw.compare(value, modulus) < 0 + base = a.remainder(prefix, modulus) + inverse = a.inverse(base, modulus) + w.need(inverse is not None, 'pairwise coprime CRT prefix') + local = a.remainder(lower, modulus) + scaled = a.multiply(local, inverse, modulus) + digit = a.remainder(value, modulus) + adjustment = arena.copy(digit) if fault == 'treat_current_as_original' else a.subtract(digit, scaled, modulus) + term = a.product(prefix, adjustment) + updated, carry = a.raw.add(lower, term) + w.need(not carry, 'CRT reconstruction capacity') + total = a.product(prefix, modulus) + arena.free_many(modulus, value, base, inverse, local, scaled, digit, + adjustment, term, lower, prefix) + lower, prefix = updated, total + w.need(seen_left, 'nonempty current CRT left group') + if not valid: + arena.free(lower); lower = arena.zero() + left_product = arena.copy(prefix) + seen_right = False + while right.read() != w.RIGHT: + seen_right = True + modulus, value = pair(right); a.admit(modulus) + base = a.remainder(prefix, modulus) + inverse = a.inverse(base, modulus) + w.need(inverse is not None, 'pairwise coprime CRT right prefix') + local = a.remainder(lower, modulus) + offset = a.multiply(local, inverse, modulus) + if fault == 'omit_right_prefix': + arena.free(offset) + original_base = a.remainder(left_product, modulus) + original_inverse = a.inverse(original_base, modulus) + offset = a.multiply(local, original_inverse, modulus) + arena.free_many(original_base, original_inverse) + if a.raw.compare(value, modulus) < 0 or fault == 'rotate_padding': + canonical = a.remainder(value, modulus) + updated = a.add(canonical, offset, modulus) + arena.free(canonical) + else: updated = arena.copy(value) + output.append(records.ROOT) + records.append_word(output, offset); records.append_word(output, updated) + output.append(records.RECORD_END) + total = a.product(prefix, modulus) + arena.free_many(modulus, value, base, inverse, local, offset, updated, prefix) + prefix = total + w.need(seen_right, 'nonempty current CRT right group') + output.append(w.RIGHT); output.rewind() + keep = {lower.slot, left_product.slot}; succeeded = True + return dict(lower=lower, product=left_product, stream=output, left_valid=valid) + finally: + left.rewind(); right.rewind() + for slot in tuple(arena.live): + if slot not in protected and slot not in keep: + arena.free(arena.words[slot]) + if not succeeded: output.clear() diff --git a/research/encoded-crt-restart/predecessor/source/research/r437-preparation-composition/predecessor4025/source/records.py b/research/encoded-crt-restart/predecessor/source/research/r437-preparation-composition/predecessor4025/source/records.py new file mode 100644 index 0000000000..4f00467a0f --- /dev/null +++ b/research/encoded-crt-restart/predecessor/source/research/r437-preparation-composition/predecessor4025/source/records.py @@ -0,0 +1,271 @@ +"""Sequential binary program/field records and typed continuation stacks. + +Runtime numerical words copy between tapes. Only tags, source codes, ranks +and row labels enter fixed finite control. Fixture encoding is separate. +""" +from words import BLANK, LEFT, ONE, RIGHT, ZERO, Meter, Unsigned, need + +WORD_END, RECORD_END = 5, 6 +ROOT, STEP, VALUE, CONSTANT, MULTIPLY, PAIR, RETURN = range(7, 14) +FINITE_BITS = 16 # Fixed vocabulary width for this compiled source instance. + + +class Tape: + def __init__(self): + self.cells = bytearray([LEFT]) + self.head = 1 + self.meter = Meter() + + def read(self): + self.meter.reads += 1 + return self.cells[self.head] if self.head < len(self.cells) else BLANK + + def write(self, symbol): + need(ZERO <= symbol <= RETURN, "fixed record alphabet") + self.meter.writes += 1 + if self.head >= len(self.cells): + self.cells.extend([BLANK]*(self.head+1-len(self.cells))) + self.cells[self.head] = symbol + + def step(self, direction): + need(direction in (-1, 1), "unit record-head move") + self.head += direction + need(self.head >= 0, "local record boundary") + self.meter.moves += 1 + + def append(self, symbol): + need(self.read() == BLANK, "append at record blank") + self.write(symbol) + self.step(1) + + def rewind(self): + self.step(-1) + while self.read() != LEFT: + self.step(-1) + self.step(1) + + def clear(self): + self.rewind() + while self.read() != BLANK: + self.write(BLANK) + self.step(1) + self.rewind() + + +def append_word(tape, word): + word.rewind() + while word.read() != RIGHT: + tape.append(word.read()) + word.step(1) + tape.append(WORD_END) + word.rewind() + + +def read_word(tape, arena): + out = arena.zero() + while tape.read() != WORD_END: + bit = tape.read() + need(bit in (ZERO, ONE) and out.read() != RIGHT, "encoded word extent") + out.write(bit) + out.step(1) + tape.step(1) + need(out.read() == RIGHT, "complete encoded word") + tape.step(1) + out.rewind() + return out + + +def append_finite(tape, value, bits=FINITE_BITS): + """Compile-time finite source/operation tag encoding.""" + need(0 <= value < 1 << bits, "compiled finite vocabulary") + for bit in range(bits): + tape.append((value >> bit) & 1) + tape.append(WORD_END) + + +def read_finite(tape, bits=FINITE_BITS): + # The accumulator ranges over a fixed finite set, independent of e/w/h. + state = 0 + for bit in range(bits): + value = tape.read() + need(value in (ZERO, ONE), "finite label bit") + state |= value << bit + tape.step(1) + need(tape.read() == WORD_END, "finite label delimiter") + tape.step(1) + return state + + +def seek_record(tape, index): + machine, arena = Unsigned(index.arena), index.arena + remaining, one = arena.copy(index), arena.literal(1) + tape.rewind() + while not remaining.zero(): + while tape.read() != RECORD_END: + need(tape.read() != BLANK, "record exists at global slot") + tape.step(1) + tape.step(1) + after = machine.subtract_exact(remaining, one) + arena.free(remaining) + remaining = after + arena.free_many(remaining, one) + + +class Stack: + def __init__(self, index_arena, residue_arena): + self.index_arena, self.residue_arena = index_arena, residue_arena + self.tape, self.reverse = Tape(), Tape() + + def empty(self): + self.tape.step(-1) + result = self.tape.read() == LEFT + self.tape.step(1) + return result + + def push(self, tag, *words): + need(tag in (VALUE, CONSTANT, MULTIPLY, PAIR, RETURN), "continuation kind") + need(len(words) == (2 if tag == VALUE else 1), "continuation arity") + self.tape.append(tag) + for word in words: + append_word(self.tape, word) + self.tape.append(RECORD_END) + + def pop(self): + need(not self.empty(), "nonempty continuation stack") + tape, reverse = self.tape, self.reverse + tape.step(-1) + need(tape.read() == RECORD_END, "continuation top delimiter") + tape.write(BLANK) + tape.step(-1) + while tape.read() not in (LEFT, RECORD_END): + reverse.append(tape.read()) + tape.write(BLANK) + tape.step(-1) + tape.step(1) + reverse.step(-1) + tag = reverse.read() + need(tag in (VALUE, CONSTANT, MULTIPLY, PAIR, RETURN), "encoded continuation kind") + reverse.write(BLANK) + reverse.step(-1) + arenas = (self.index_arena, self.index_arena) if tag == VALUE else (self.residue_arena,) + words = [] + for arena in arenas: + out = arena.zero() + while reverse.read() != WORD_END: + bit = reverse.read() + need(bit in (ZERO, ONE) and out.read() != RIGHT, "continuation binary word") + out.write(bit) + out.step(1) + reverse.write(BLANK) + reverse.step(-1) + need(out.read() == RIGHT, "complete continuation operand") + reverse.write(BLANK) + reverse.step(-1) + out.rewind() + words.append(out) + need(reverse.read() == LEFT, "complete continuation record") + reverse.step(1) + return tag, tuple(words) + + +class Program: + """Encoded root and admitted chronological steps; numerical fields are words.""" + def __init__(self, index_arena, residue_arena, code_bits=FINITE_BITS): + self.index_arena, self.residue_arena = index_arena, residue_arena + self.code_bits = code_bits + self.tape = Tape() + + def root(self): + self.tape.rewind() + need(self.tape.read() == ROOT, "root record") + self.tape.step(1) + size = read_word(self.tape, self.index_arena) + unit = read_word(self.tape, self.residue_arena) + depth = read_word(self.tape, self.index_arena) + need(self.tape.read() == RECORD_END, "root record end") + self.tape.rewind() + return size, unit, depth + + def step(self, level): + need(not level.zero(), "positive step level") + seek_record(self.tape, level) + need(self.tape.read() == STEP, "step record") + self.tape.step(1) + metadata = tuple(read_finite(self.tape, self.code_bits if field == 1 else FINITE_BITS) + for field in range(6)) + parent = read_word(self.tape, self.index_arena) + child = read_word(self.tape, self.index_arena) + need(self.tape.read() == RECORD_END, "step record end") + self.tape.rewind() + return metadata, parent, child + + @classmethod + def fixture(cls, index_arena, residue_arena, root_size, root_unit, events, code_bits=FINITE_BITS): + """Fixture-only serialization; runtime computes and validates extents.""" + out = cls(index_arena, residue_arena, code_bits) + out.tape.append(ROOT) + for arena, value in ((index_arena, root_size), (residue_arena, root_unit), (index_arena, len(events))): + word = arena.input(value) + append_word(out.tape, word) + arena.free(word) + out.tape.append(RECORD_END) + size = root_size + for kind, code, rank, field, reverse, half in events: + f = size//64 + child = rank*f if kind == 0 else f//2 if half else f + out.tape.append(STEP) + for field_index, label in enumerate((kind, code, rank, field, int(reverse), int(half))): + append_finite(out.tape, label, code_bits if field_index == 1 else FINITE_BITS) + for value in (size, child): + word = index_arena.input(value) + append_word(out.tape, word) + index_arena.free(word) + out.tape.append(RECORD_END) + size = child + out.tape.rewind() + return out + + +class Fields: + def __init__(self, index_arena, residue_arena, code_bits=FINITE_BITS): + self.index_arena, self.residue_arena = index_arena, residue_arena + self.code_bits = code_bits + self.tape = Tape() + + def check_code(self, slot, code): + seek_record(self.tape, slot) + observed = read_finite(self.tape, self.code_bits) + self.tape.rewind() + need(observed == code, "original global raw-field code") + + def end(self, after): + seek_record(self.tape, after) + complete = self.tape.read() == BLANK + self.tape.rewind() + need(complete, "exact frozen/current field prefix") + + def read(self, slot, code, depth): + need(Unsigned(self.index_arena).compare(slot, depth) < 0, "frozen field excludes current/future slot") + seek_record(self.tape, slot) + observed = read_finite(self.tape, self.code_bits) + need(observed == code, "exact encoded raw-field specification") + out = [[read_word(self.tape, self.residue_arena) for _ in range(64)] for _ in range(64)] + need(self.tape.read() == RECORD_END, "complete 64-dimensional raw high field") + self.tape.rewind() + return out + + @classmethod + def fixture(cls, index_arena, residue_arena, fields, code_bits=FINITE_BITS): + """Load canonical raw-field fixture data before measured execution.""" + out = cls(index_arena, residue_arena, code_bits) + for code, high in fields: + append_finite(out.tape, code, code_bits) + need(len(high) == 64 and all(len(row) == 64 for row in high), "field fixture shape") + for row in high: + for value in row: + word = residue_arena.input(value) + append_word(out.tape, word) + residue_arena.free(word) + out.tape.append(RECORD_END) + out.tape.rewind() + return out diff --git a/research/encoded-crt-restart/predecessor/source/research/r437-preparation-composition/predecessor4025/source/words.py b/research/encoded-crt-restart/predecessor/source/research/r437-preparation-composition/predecessor4025/source/words.py new file mode 100644 index 0000000000..8d4ba37e27 --- /dev/null +++ b/research/encoded-crt-restart/predecessor/source/research/r437-preparation-composition/predecessor4025/source/words.py @@ -0,0 +1,415 @@ +"""Binary word tapes; unbounded numerical values stay in tape cells. + +Only zero/one carry states and fixed register/operation tags enter Python +control. Fixture loading/inspection methods are outside measured execution. +The arena bounds the tape inventory by a compile-time register capacity. +""" +ZERO, ONE, LEFT, RIGHT, BLANK = range(5) + + +def need(test, message): + if not test: + raise ValueError(message) + + +class Meter: + __slots__ = ("reads", "writes", "moves", "peak_live", "allocations") + + def __init__(self): + self.reads = self.writes = self.moves = self.peak_live = self.allocations = 0 + + def record(self): + return {name: getattr(self, name) for name in self.__slots__} + + +class Word: + __slots__ = ("arena", "slot", "cells", "head") + + def __init__(self, arena, slot): + self.arena, self.slot = arena, slot + self.cells = bytearray([LEFT] + [BLANK]*(arena.bits+1)) + self.head = 1 + + def read(self): + self.arena.meter.reads += 1 + return self.cells[self.head] + + def write(self, symbol): + need(symbol in (ZERO, ONE, RIGHT, BLANK), "word tape alphabet") + self.arena.meter.writes += 1 + self.cells[self.head] = symbol + + def step(self, direction): + need(direction in (-1, 1), "unit word-head movement") + self.head += direction + need(0 <= self.head < len(self.cells), "local word boundary") + self.arena.meter.moves += 1 + + def rewind(self): + self.step(-1) + while self.read() != LEFT: + self.step(-1) + self.step(1) + + def msb(self): + self.rewind() + while self.read() != RIGHT: + self.step(1) + self.step(-1) + + def zero(self): + self.rewind() + nonzero = False + while True: + bit = self.read() + if bit == RIGHT: + break + need(bit in (ZERO, ONE), "complete binary word") + nonzero = nonzero or bit == ONE + self.step(1) + self.rewind() + return not nonzero + + def erase(self): + self.rewind() + while self.read() != RIGHT: + self.write(BLANK) + self.step(1) + self.write(BLANK) + self.rewind() + + def inspect(self): + """Checker-only decoding; arithmetic code must not call this.""" + need(self.head == 1 and self.cells[-1] == RIGHT, "inspect a restored word") + return sum(bit << i for i, bit in enumerate(self.cells[1:-1])) + + +class Arena: + def __init__(self, bits, capacity=65536): + need(bits >= 2 and capacity > 0, "fixed word context") + self.bits, self.capacity = bits, capacity + self.meter = Meter() + self.words, self.available, self.live = [], [], set() + self.template = Word(self, -1) + self.template.cells[1:-1] = bytes([ZERO])*bits + self.template.cells[-1] = RIGHT + + def zero(self): + if self.available: + slot = self.available.pop() + out = self.words[slot] + else: + slot = len(self.words) + need(slot < self.capacity, "fixed register inventory") + out = Word(self, slot) + self.words.append(out) + need(slot not in self.live, "fresh numerical register") + self.live.add(slot) + self.meter.allocations += 1 + self.meter.peak_live = max(self.meter.peak_live, len(self.live)) + source = self.template + source.rewind() + while source.read() != RIGHT: + need(out.read() == BLANK, "erased register before reuse") + out.write(ZERO) + out.step(1) + source.step(1) + need(out.read() == BLANK, "erased right delimiter cell") + out.write(RIGHT) + out.rewind() + source.rewind() + return out + + def literal(self, value): + """Compile-time literal only; never decode a runtime word here.""" + need(isinstance(value, int) and value >= 0, "unsigned literal") + out = self.zero() + for bit in tuple((value >> i) & 1 for i in range(value.bit_length())): + need(out.read() != RIGHT, "literal fits the fixed word") + out.write(bit) + out.step(1) + out.rewind() + return out + + def input(self, value): + """Fixture-only loading of an encoded input word.""" + return self.literal(value) + + def copy(self, source): + need(source.arena is self, "one word extent") + out = self.zero() + source.rewind() + while source.read() != RIGHT: + out.write(source.read()) + source.step(1) + out.step(1) + out.rewind() + source.rewind() + return out + + def free(self, word): + need(word.arena is self and word.slot in self.live, "owned numerical register") + word.erase() + self.live.remove(word.slot) + self.available.append(word.slot) + + def free_many(self, *words): + for word in words: + self.free(word) + + def rollback(self, protected): + """Erase owned temporary roles on a rejecting path; capacity is fixed.""" + for slot in tuple(self.live): + if slot not in protected: + self.free(self.words[slot]) + for slot in protected: + self.words[slot].rewind() + + +class Unsigned: + def __init__(self, arena): + self.arena = arena + + def compare(self, a, b): + need(a.arena is b.arena is self.arena, "comparison word context") + if a is b: + return 0 + a.rewind() + b.rewind() + state = 0 + while a.read() != RIGHT: + x, y = a.read(), b.read() + need(x in (ZERO, ONE) and y in (ZERO, ONE), "comparison binary digits") + if x != y: + state = 1 if x == ONE else -1 + a.step(1) + b.step(1) + need(b.read() == RIGHT, "equal comparison extents") + a.rewind() + b.rewind() + return state + + def add(self, a, b): + out = self.arena.zero() + a.rewind() + b.rewind() + carry = 0 + while a.read() != RIGHT: + x, y = a.read(), b.read() + total = x+y+carry # Four finite carry states, not word arithmetic. + out.write(total & 1) + carry = total >> 1 + a.step(1) + if b is not a: + b.step(1) + out.step(1) + need(b.read() == RIGHT, "equal addition extents") + a.rewind() + b.rewind() + out.rewind() + return out, carry + + def subtract(self, a, b): + out = self.arena.zero() + a.rewind() + b.rewind() + borrow = 0 + while a.read() != RIGHT: + x, y = a.read(), b.read() + digit = x-y-borrow # One finite borrow bit. + out.write(digit & 1) + borrow = int(digit < 0) + a.step(1) + if b is not a: + b.step(1) + out.step(1) + need(b.read() == RIGHT, "equal subtraction extents") + a.rewind() + b.rewind() + out.rewind() + return out, borrow + + def subtract_exact(self, a, b): + out, borrow = self.subtract(a, b) + need(not borrow, "unsigned subtraction precondition") + return out + + def shift_add_bit(self, a, bit): + need(bit in (ZERO, ONE), "one incoming bit") + out = self.arena.zero() + a.rewind() + carry = bit + while a.read() != RIGHT: + previous = a.read() + out.write(carry) + carry = previous + a.step(1) + out.step(1) + a.rewind() + out.rewind() + need(not carry, "reserved high-bit margin") + return out + + def divmod(self, numerator, denominator): + need(not denominator.zero(), "nonzero binary divisor") + # A zero high bit leaves room for 2*remainder+bit. + denominator.msb() + margin = denominator.read() + denominator.rewind() + need(margin == ZERO, "binary divisor has the high-bit margin") + scan = self.arena.copy(numerator) + quotient, remainder = self.arena.zero(), self.arena.zero() + scan.msb() + quotient.msb() + while scan.read() != LEFT: + shifted = self.shift_add_bit(remainder, scan.read()) + self.arena.free(remainder) + if self.compare(shifted, denominator) >= 0: + remainder = self.subtract_exact(shifted, denominator) + self.arena.free(shifted) + quotient.write(ONE) + else: + remainder = shifted + quotient.write(ZERO) + scan.step(-1) + quotient.step(-1) + scan.step(1) + quotient.step(1) + self.arena.free(scan) + return quotient, remainder + + def times_small(self, a, constant): + """Multiply by a fixed finite matrix/rank label; preserve the word margin.""" + need(0 <= constant <= 128, "finite index multiplier") + result = self.arena.zero() + for bit in tuple((constant >> i) & 1 for i in range(constant.bit_length()-1, -1, -1)): + doubled, carry = self.add(result, result) + need(not carry, "index multiplication margin") + self.arena.free(result) + if bit: + result, carry = self.add(doubled, a) + need(not carry, "index multiplication extent") + self.arena.free(doubled) + else: + result = doubled + return result + + def increment_in_place(self, word): + """Ripple increment for a bounded address counter; restore its head.""" + word.rewind() + while word.read() == ONE: + word.write(ZERO) + word.step(1) + need(word.read() == ZERO, "ripple increment has space") + word.write(ONE) + word.rewind() + + +class Ring: + """Canonical residues modulo an encoded M>1 with one leading zero bit.""" + def __init__(self, modulus): + self.modulus, self.arena = modulus, modulus.arena + self.raw = Unsigned(self.arena) + self.one = self.arena.literal(1) + try: + need(self.raw.compare(modulus, self.one) > 0, "modulus exceeds one") + modulus.msb() + margin = modulus.read() + modulus.step(-1) + significant = modulus.read() + modulus.rewind() + need(margin == ZERO and significant == ONE, "canonical modulus word with one high-bit margin") + except ValueError: + self.arena.free(self.one) + raise + + def close(self): + self.arena.free(self.one) + + def add(self, a, b): + total, carry = self.raw.add(a, b) + need(not carry, "canonical modular addition margin") + if self.raw.compare(total, self.modulus) >= 0: + out = self.raw.subtract_exact(total, self.modulus) + self.arena.free(total) + return out + return total + + def subtract(self, a, b): + if self.raw.compare(a, b) >= 0: + return self.raw.subtract_exact(a, b) + larger, carry = self.raw.add(a, self.modulus) + need(not carry, "canonical modular subtraction margin") + out = self.raw.subtract_exact(larger, b) + self.arena.free(larger) + return out + + def negate(self, a): + zero = self.arena.zero() + out = self.subtract(zero, a) + self.arena.free(zero) + return out + + def multiply(self, a, b): + if a.zero() or b.zero(): + return self.arena.zero() + if self.raw.compare(a, self.one) == 0: + return self.arena.copy(b) + if self.raw.compare(b, self.one) == 0: + return self.arena.copy(a) + scan = self.arena.copy(b) + result = self.arena.zero() + scan.msb() + while scan.read() != LEFT: + doubled = self.add(result, result) + self.arena.free(result) + if scan.read() == ONE: + result = self.add(doubled, a) + self.arena.free(doubled) + else: + result = doubled + scan.step(-1) + scan.step(1) + self.arena.free(scan) + return result + + def inverse(self, a): + """Euclid, with Bezout coefficients reduced modulo M; None for nonunits.""" + r0, r1 = self.arena.copy(self.modulus), self.arena.copy(a) + t0, t1 = self.arena.zero(), self.arena.copy(self.one) + while not r1.zero(): + quotient, r2 = self.raw.divmod(r0, r1) + if self.raw.compare(quotient, self.modulus) >= 0: + reduced = self.raw.subtract_exact(quotient, self.modulus) + self.arena.free(quotient) + quotient = reduced + product = self.multiply(quotient, t1) + t2 = self.subtract(t0, product) + self.arena.free_many(quotient, product, r0, t0) + r0, r1, t0, t1 = r1, r2, t1, t2 + unit = self.raw.compare(r0, self.one) == 0 + self.arena.free_many(r0, r1, t1) + if unit: + return t0 + self.arena.free(t0) + return None + + def literal(self, constant): + """Compile a fixed signed integer through binary modular operations.""" + negative = constant < 0 + magnitude = abs(constant) + result = self.arena.zero() + instructions = tuple((magnitude >> i) & 1 for i in range(magnitude.bit_length()-1, -1, -1)) + for bit in instructions: + doubled = self.add(result, result) + self.arena.free(result) + if bit: + result = self.add(doubled, self.one) + self.arena.free(doubled) + else: + result = doubled + if negative: + out = self.negate(result) + self.arena.free(result) + result = out + return result diff --git a/research/encoded-crt-restart/restart.py b/research/encoded-crt-restart/restart.py new file mode 100644 index 0000000000..3a3d859639 --- /dev/null +++ b/research/encoded-crt-restart/restart.py @@ -0,0 +1,113 @@ +"""Persistent 79-role restart for the pinned encoded balanced CRT endpoints. + +Only the first acquisition calls Port or Bank allocation. Successful calls +establish the whole-history blank invariant used at the next restart; this +is not a cleaner for arbitrary externally dirtied retired tails. +Prepared for Jerry Chen / CubeJerry with substantial OpenAI assistance. +Apache-2.0. +""" +from types import SimpleNamespace + + +class Restart: + """One physical inventory, one active endpoint, no runtime geometry.""" + + def __init__(self, words, records, entry, numeric, owner, canonical, + forward, inverse, subtractive, writer, ports=None): + self.w, self.r, self.e = words, records, entry + self.numeric, self.subtractive = numeric, subtractive + self.canonical, self.forward = canonical, forward + self.reverse, self.writer = inverse.bind(forward), writer + if ports is None: + self.bank = owner.Bank(words, entry) + # Eight guard, seven topology, one staging roles, in the unchanged + # constructor's fixed order. Each keeps its original meter/backing. + self.external = tuple(entry.Port(words) for _ in range(16)) + for port in self.external: + port.retire() + else: + # Optional pre-owned, completely blank historical inventory. + # Blank tails are an admission premise, not inferred by these + # constant-size local checks. + words.need(len(ports) == 79, 'complete supplied role inventory') + self.bank = owner.Bank(words, entry, ports=ports[:63]) + self.external = tuple(ports[63:]) + self.ports = (*self.bank.ports, *self.external) + words.need(len({id(p.cells) for p in self.ports}) == 79, + '79 distinct persistent histories') + for port in self.ports: + words.need(port.head == 1 and port.read() == words.BLANK, + 'initial retired role body') + port.step(-1) + words.need(port.read() == words.BLANK, 'initial retired role marker') + port.step(1) + self.active = False + self.cursor = 0 + self.current = None + + def _bank(self, words, entry): + words.need(words is self.w and self.active and not self.bank.busy, + 'same retired numerical bank') + return self.bank + + def _take(self, words): + words.need(words is self.w and self.active and self.cursor < 16, + 'fixed external restart role') + port = self.external[self.cursor] + self.cursor += 1 + words.need(port.head == 1 and port.read() == words.BLANK, + 'retired restart body') + port.step(-1) + words.need(port.read() == words.BLANK, 'retired restart marker') + port.write(words.LEFT) + port.step(1) + return port + + def start(self, source, reverse=False): + """Rearm local markers, then read all geometry from the actual source. + + The source is a supplied, disjoint, already encoded borrowed port at + its origin. A direction bit chooses one of two fixed providers. + """ + w = self.w + w.need(type(reverse) is bool, 'finite direction flag') + w.need(not self.active and not self.bank.busy, + 'previous whole invocation must finish') + w.need(source.head == 1, 'source at admitted origin') + w.need(id(source.cells) not in {id(p.cells) for p in self.ports}, + 'source disjoint from all 79 histories') + self.active, self.cursor = True, 0 + adapter = SimpleNamespace(Port=self._take, Entry=self.e.Entry) + fixed_owner = SimpleNamespace(Bank=self._bank) + frontend = self.reverse if reverse else self.forward + numeric = self.subtractive if reverse else self.numeric + # The original constructor obtains the same sixteen ports through + # the fixed adapter. No history, meter or backing is reinitialized. + self.current = self.writer.Endpoint(frontend, w, self.r, adapter, + numeric, fixed_owner, self.canonical, source) + w.need(self.cursor == 16, 'complete external role reentry') + return self.current + + def finish(self): + """Release only after the complete endpoint and source commit retire.""" + w, endpoint = self.w, self.current + w.need(self.active and endpoint is not None, + 'one active whole invocation') + w.need(endpoint.iterator.closed and not endpoint.iterator.live and + not self.bank.busy and not endpoint.pending, + 'whole traversal and source commit must retire') + # These are fixed-role local checks. The full historical-tail claim + # follows by successful predecessor retirement, not a hidden scan. + for port in self.ports: + w.need(port.head == 1 and port.read() == w.BLANK, + 'complete retired role head and body') + port.step(-1) + w.need(port.read() == w.BLANK, 'complete retired role marker') + port.step(1) + self.current = None + self.active = False + + def run(self, source, reverse=False): + endpoint = self.start(source, reverse) + endpoint.run() + self.finish() diff --git a/research/encoded-crt-restart/verify.py b/research/encoded-crt-restart/verify.py new file mode 100644 index 0000000000..757d7485b3 --- /dev/null +++ b/research/encoded-crt-restart/verify.py @@ -0,0 +1,246 @@ +"""Bounded source-executing restart checks; finite evidence, not a proof kernel.""" +from pathlib import Path +import json +import sys + +# Load source bytes explicitly, also under -I/-B; do not consume cached bytecode. +_scope = {'__file__': str(Path(__file__).with_name('checks.py')), '__name__': 'checks'} +exec(compile(Path(__file__).with_name('checks.py').read_bytes(), _scope['__file__'], 'exec'), _scope) +globals().update({k: v for k, v in _scope.items() if not k.startswith('__')}) + + +def observe_call(m, owner, source, fields, moduli, widths, reverse, initial, maxima): + ids = tuple(id(p.cells) for p in owner.ports) + meter_ids = tuple(id(p.meter) for p in owner.ports) + old_lengths = tuple(len(p.cells) for p in owner.ports) + before = actions([source, *owner.ports]) + original_source, original_id = bytes(source.cells), id(source.cells) + allowed = set().union(*map(set, fields)) + trace = list(schedule(len(moduli), reverse)) + expected = values(source, fields) + index, meters, precisions = 0, [], [] + rearm_actions = 0 + take = owner._take + def observed_take(words): + nonlocal rearm_actions + at = actions(owner.ports) + out = take(words) + rearm_actions += actions(owner.ports)-at + return out + owner._take = observed_take + try: + with sealed(m): + endpoint = owner.start(source, reverse) + stage = endpoint.stage + def observed_stage(lease): + nonlocal index, expected + need(index < len(trace), 'no extra runtime node') + start, half = trace[index] + precision = 1+sum(widths[start:start+2*half]) + need(values(source, fields) == expected, 'committed actual current source') + expected = node_oracle(moduli, expected, start, half, reverse) + precisions.append(precision) + for guard in endpoint.iterator.guards: + need(guard.cells[:precision+2] == bytearray([m.w.LEFT]+[m.w.ZERO]*precision+[m.w.RIGHT]), + 'new exact guard precision') + need(all(x == m.w.BLANK for x in guard.cells[precision+2:]), + 'all older guard history blank') + state = bytes(source.cells), source.head + stage(lease) + need((bytes(source.cells), source.head) == state, 'staging borrows source read-only') + meters.append(lease.actual.context.arena.meter) + index += 1 + endpoint.stage = observed_stage + endpoint.run() # Only the real encoded frontend drives traversal. + at = actions(owner.ports) + owner.finish() + finish_actions = actions(owner.ports)-at + finally: + owner._take = take + need(index == len(trace), 'all actual nodes visited') + need(rearm_actions == 80 and finish_actions == 316, '396 paid restart boundary actions') + need(values(source, fields) == expected, 'defining-congruence endpoint') + need(source.head == 1 and id(source.cells) == original_id, 'same physical source and head') + need(len(source.cells) == len(original_source) and + all(source.cells[i] == x for i, x in enumerate(original_source) if i not in allowed), + 'all source metadata and historical tail preserved') + need(tuple(id(p.cells) for p in owner.ports) == ids, 'same 79 backing identities') + need(tuple(id(p.meter) for p in owner.ports) == meter_ids, 'meters never reset') + need(all(len(p.cells) >= n for p, n in zip(owner.ports, old_lengths)), 'no history shortening') + need(blank(m, owner.ports), 'all 79 full histories retired') + need(not owner.active and not owner.bank.busy and owner.current is None, 'whole inventory available') + a, d = sum(widths), len(widths) + maxima[0], maxima[1] = max(maxima[0], a), max(maxima[1], d) + envelope = role_envelope(*maxima) + need(len(envelope) == 79, 'complete role envelope') + need(all(len(p.cells) <= max(k, r) for p, k, r in zip(owner.ports, initial, envelope)), + 'per-role complete historical envelope') + volume = 2+3*a+4*d + raw_bound = 396+2**19*(volume+2)**2+4096 + raw_bound += sum(2**21*(p+2)**4+2**16*(p+2)**2+4096 for p in precisions) + work = actions([source, *owner.ports])-before + work += sum(x.reads+x.writes+x.moves for x in meters) + need(work <= raw_bound, 'full source-operation envelope') + protected = sum(p.cells.origin if isinstance(p.cells, ShiftedCells) else 0 + for p in owner.ports) + return {'reverse': reverse, 'axes': d, 'width_sum': a, 'precisions': precisions, + 'nodes': index, 'actions': work, 'raw_bound': raw_bound, + 'retained_private': protected+sum(len(p.cells) for p in owner.ports), + 'private_bound': protected+sum(max(k, r) for k, r in zip(initial, envelope)), + 'output': list(expected)} + + +def exercise_sequence(m, specs, supplied=False, translated=False): + source = m.e.Port(m.w) + supplied_ports = None + if supplied: + supplied_ports = tuple(m.e.Port(m.w) for _ in range(79)) + for i, p in enumerate(supplied_ports): + p.retire() + p.cells.extend([m.w.BLANK]*(7+(i*19)%71)) + if translated: + need(supplied_ports is not None, 'translated fixtures are preowned admission states') + for i, p in enumerate([source, *supplied_ports]): + prefix = bytearray((m.w.LEFT, m.w.RIGHT, m.w.ONE, m.w.ZERO)[j % 4] + for j in range(1+(7*i)%17)) + p.cells = ShiftedCells(p.cells, prefix) + before_acquisition = actions(supplied_ports) if supplied_ports else 0 + owner = acquire(m, supplied_ports) + acquisition = actions(owner.ports)-before_acquisition + need(acquisition == (316 if supplied else 1264), 'paid initial acquisition and validation') + prefixes = [bytes(p.cells.data[:p.cells.origin]) for p in [source, *owner.ports]] if translated else [] + initial = tuple(len(p.cells) for p in owner.ports) + maxima, receipts = [0, 0], [] + stable = tuple(id(p.cells) for p in owner.ports) + for moduli, widths, values_in, directions in specs: + fields = fixture(m, source, moduli, widths, values_in, 29) + original = values(source, fields) + for direction in directions: + receipts.append(observe_call(m, owner, source, fields, moduli, widths, + direction, initial, maxima)) + need(tuple(id(p.cells) for p in owner.ports) == stable, 'one inventory across all inputs') + if translated: + need([bytes(p.cells.data[:p.cells.origin]) for p in [source, *owner.ports]] == prefixes, + 'hostile physical left prefixes preserved') + if tuple(directions) in ((False, True), (True, False), (False, True, True, False)): + need(values(source, fields) == original, 'same-inventory round trip') + protected = sum(p.cells.origin if isinstance(p.cells, ShiftedCells) else 0 + for p in owner.ports) + return {'supplied_clean_history': supplied, 'translated_origins': translated, + 'protected_private_left_backing': protected, + 'initial_private_backing': protected+sum(initial), + 'acquisition_actions': acquisition, 'max_width_sum': maxima[0], + 'max_axes': maxima[1], 'calls': receipts, 'roles': 79} + + +def controls(m): + labels = [] + def rejects(label, action, message): + try: + action() + except ValueError as error: + need(message in str(error), 'specific rejection '+label+': '+str(error)) + labels.append(label) + else: + raise ValueError('undetected negative control '+label) + def setup(cls=None): + owner = acquire(m, cls=cls) + source = m.e.Port(m.w) + fields = fixture(m, source, (3,5), (2,3), (1,1), 19) + return owner, source, fields + owner, source, fields = setup() + endpoint = owner.start(source) + rejects('restart_while_traversal_active', lambda: owner.start(source), 'must finish') + rejects('finish_before_full_traversal', owner.finish, 'must retire') + lease = endpoint.iterator.next() + endpoint.stage(lease) + lease.close() + rejects('finish_before_source_commit', owner.finish, 'must retire') + endpoint.commit() + owner.finish() + rejects('double_finish', owner.finish, 'one active') + rejects('non_boolean_direction', lambda: owner.start(source, 1), 'finite direction') + rejects('source_aliases_private_role', lambda: owner.start(owner.ports[64]), 'source disjoint') + rejects('incomplete_supplied_inventory', lambda: acquire(m, owner.ports[:-1]), 'complete supplied') + bad = (*owner.ports[:78], owner.ports[0]) + rejects('aliased_supplied_inventory', lambda: acquire(m, bad), '79 distinct') + port = owner.ports[68] + port.cells[0] = m.w.LEFT + rejects('supplied_unretired_marker', lambda: acquire(m, owner.ports), 'initial retired role marker') + port.cells[0] = m.w.BLANK + class MissingMarker(m.restart.Restart): + def _take(self, words): + p = super()._take(words) + p.step(-1); p.write(words.BLANK); p.step(1) + return p + wrong, src, _ = setup(MissingMarker) + rejects('omitted_rearm_marker', lambda: wrong.run(src), 'unit local movement') + class FreshRole(m.restart.Restart): + def _take(self, words): + self.e.Port(words) + return super()._take(words) + wrong, src, _ = setup(FreshRole) + with sealed(m): + rejects('hidden_fresh_port_on_restart', lambda: wrong.run(src), 'new role') + class WrongDirection(m.restart.Restart): + def start(self, source, reverse=False): + return super().start(source, False) + wrong, src, f = setup(WrongDirection) + initial = tuple(len(p.cells) for p in wrong.ports) + rejects('wrong_inverse_provider', lambda: observe_call(m,wrong,src,f,(3,5),(2,3),True,initial,[0,0]), + 'defining-congruence endpoint') + # A dirty hidden tail is outside admission: demonstrate that it cannot + # be inferred clean from two local blank observations at restart. + owner, src, f = setup() + owner.run(src) + victim = owner.ports[0] + victim.cells.extend([m.w.BLANK]*80+[m.w.ONE]) + owner.run(src, True) + rejects('outside_contract_dirty_tail_detected_by_observer', + lambda: need(blank(m,owner.ports), 'whole-history blank contract'), 'whole-history blank') + # These two small abstract histories witness why max-of-total footprints + # is not a general retained-space theorem. + rows = ((9,1),(1,9)) + rejects('max_of_totals_undercharges_distinct_role_histories', + lambda: need(sum(max(x[i] for x in rows) for i in range(2)) <= max(map(sum,rows)), + 'sum of per-role historical maxima'), 'per-role historical') + return labels + + +def main(): + source_count = authenticate() + m = modules() + for module in (m.f, m.writer, m.inv): + poison(module) + pair = [((3,5),(2,3),(a,b),(False,True,True,False)) + for a in range(4) for b in range(8)] + four = [((2,3,5,7),(2,2,3,3),x,(False,True,True,False)) + for x in ((0,0,0,0),(1,2,4,6),(1,1,1,1),(3,2,4,6), + (1,3,1,1),(3,3,7,7),(0,1,0,0),(0,1,2,1))] + grow = [ + ((3,5),(2,3),(3,7),(False,True)), + ((2,3,5,7,11,13,17,19),(4,4,4,4,5,5,5,5),(1,2,3,4,5,6,7,8),(True,False)), + ((2,3,5,7),(2,2,3,3),(1,3,1,1),(False,True)), + ((4,9),(3,4),(7,15),(True,False)), + ((2,3,5,7),(4,4,5,5),(15,4,31,30),(True,False)), + ((2,3,5,7,11,13,17,19),(5,5,5,5,5,5,5,5),(31,2,3,4,31,6,7,8),(False,True)), + ((3,5),(2,3),(1,2),(True,False)), + ] + sequences = [exercise_sequence(m,pair), exercise_sequence(m,four), + exercise_sequence(m,grow,True,True)] + result = {'status':'PASS_ENCODED_CRT_PERSISTENT_RESTART','source_count':source_count, + 'sequences':sequences,'controls':controls(m),'new_kappa':None, + 'scope':'successful 79-role source-relative restart; no arbitrary dirty-tail cleanup'} + result['calls'] = sum(len(s['calls']) for s in sequences) + result['nodes'] = sum(c['nodes'] for s in sequences for c in s['calls']) + rendered = json.dumps(result,sort_keys=True,indent=2)+'\n' + if '--write-result' in sys.argv: + (HERE/'RESULT.json').write_text(rendered) + else: + need(rendered == (HERE/'RESULT.json').read_text(), 'frozen exact receipt') + print(result['status'], 'calls='+str(result['calls']), 'nodes='+str(result['nodes']), + 'roles=79', 'controls='+str(len(result['controls']))) + + +if __name__ == '__main__': + main()